import*as e from"three";import{BufferGeometry as t,BufferAttribute as n,TrianglesDrawMode as r,TriangleFanDrawMode as i,TriangleStripDrawMode as a,Loader as o,LoaderUtils as s,FileLoader as u,Color as l,LinearSRGBColorSpace as c,SpotLight as h,PointLight as d,DirectionalLight as f,MeshBasicMaterial as p,SRGBColorSpace as v,MeshPhysicalMaterial as m,Vector2 as g,Matrix4 as y,Vector3 as _,Quaternion as x,InstancedMesh as w,Object3D as b,TextureLoader as A,ImageBitmapLoader as M,InterleavedBuffer as T,InterleavedBufferAttribute as k,LinearFilter as S,LinearMipmapLinearFilter as C,RepeatWrapping as R,PointsMaterial as L,Material as P,LineBasicMaterial as E,MeshStandardMaterial as I,DoubleSide as O,PropertyBinding as D,SkinnedMesh as N,Mesh as U,LineSegments as F,Line as B,LineLoop as z,Points as G,Group as V,PerspectiveCamera as H,MathUtils as j,OrthographicCamera as W,Skeleton as X,AnimationClip as K,Bone as Y,InterpolateLinear as Q,ColorManagement as Z,NearestFilter as q,NearestMipmapNearestFilter as J,LinearMipmapNearestFilter as $,NearestMipmapLinearFilter as ee,ClampToEdgeWrapping as te,MirroredRepeatWrapping as ne,InterpolateDiscrete as re,FrontSide as ie,Texture as ae,VectorKeyframeTrack as oe,NumberKeyframeTrack as se,QuaternionKeyframeTrack as ue,Box3 as le,Sphere as ce,Interpolant as he,Float32BufferAttribute as de,ShaderMaterial as fe,UniformsUtils as pe,WebGLRenderTarget as ve,HalfFloatType as me,NoBlending as ge,Clock as ye,AdditiveBlending as _e,ShaderChunk as xe,RawShaderMaterial as we,SRGBTransfer as be,LinearToneMapping as Ae,ReinhardToneMapping as Me,CineonToneMapping as Te,ACESFilmicToneMapping as ke}from"three";import Se from"lodash";import Ce from"html2canvas";import{TilesRenderer as Re}from"3d-tiles-renderer";function Le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Pe(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function Ee(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Pe(a,r,i,o,s,"next",e)}function s(e){Pe(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Ie(e,t,n){return t=Be(t),je(e,Ge()?Reflect.construct(t,n||[],Be(e).constructor):t.apply(e,n))}function Oe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function De(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Qe(r.key),r)}}function Ne(e,t,n){return t&&De(e.prototype,t),n&&De(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ue(e,t,n){return(t=Qe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fe(){return Fe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Be(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Fe.apply(null,arguments)}function Be(e){return Be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Be(e)}function ze(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Xe(e,t)}function Ge(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ge=function(){return!!e})()}function Ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(n),!0).forEach((function(t){Ue(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function je(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function We(){We=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var a=t&&t.prototype instanceof g?t:g,o=Object.create(a.prototype),s=new L(r||[]);return i(o,"_invoke",{value:k(e,n,s)}),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var d="suspendedStart",f="suspendedYield",p="executing",v="completed",m={};function g(){}function y(){}function _(){}var x={};l(x,o,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(P([])));b&&b!==n&&r.call(b,o)&&(x=b);var A=_.prototype=g.prototype=Object.create(x);function M(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(i,a,o,s){var u=h(e[i],e,a);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(c).then((function(e){l.value=e,o(l)}),(function(e){return n("throw",e,o,s)}))}s(u.arg)}var a;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}})}function k(t,n,r){var i=d;return function(a,o){if(i===p)throw Error("Generator is already running");if(i===v){if("throw"===a)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var u=S(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var l=h(t,n,r);if("normal"===l.type){if(i=r.done?v:f,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=v,r.method="throw",r.arg=l.arg)}}}function S(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var a=h(i,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,m;var o=a.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function P(t){if(t||""===t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return y.prototype=_,i(A,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:y,configurable:!0}),y.displayName=l(_,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,l(e,u,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},M(T.prototype),l(T.prototype,s,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new T(c(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},M(A),l(A,u,"Generator"),l(A,o,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;R(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:P(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function Xe(e,t){return Xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Xe(e,t)}function Ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],u=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){l=!0,i=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(e,t)||qe(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ye(e){return function(e){if(Array.isArray(e))return Le(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||qe(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qe(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function Ze(e){return Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ze(e)}function qe(e,t){if(e){if("string"==typeof e)return Le(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Le(e,t):void 0}}var Je=function(){return Ne((function e(){Oe(this,e),Ue(this,"eventMap",{})}),[{key:"addEventListener",value:function(e,t){return this.eventMap[e]||(this.eventMap[e]=[]),this.eventMap[e].push(t),this}},{key:"on",value:function(e,t){return this.addEventListener(e,t),this}},{key:"removeEventListener",value:function(e,t){if(!this.eventMap[e])return this;var n=this.eventMap[e].findIndex((function(e){return e===t}));return n>-1&&this.eventMap[e].splice(n,1),this}},{key:"off",value:function(e,t){return this.removeEventListener(e,t),this}},{key:"handleEvent",value:function(e,t){for(var n=this.eventMap[e]||[],r=0;r<n.length;r++)"function"==typeof n[r]&&n[r].apply(n[r],[t,this]);return this}}])}(),$e=0,et=null,tt=function(){function t(e){var n,r;if(Oe(this,t),Ue(r=Ie(this,t),"id",null),Ue(r,"title",""),Ue(r,"_canvas",null),Ue(r,"composer",null),Ue(r,"_conf",{renderOption:{antialias:!1,precision:"highp"},alone:!0,zIndex:120,visible:!0}),Ue(r,"_zooms",[3,22]),Ue(r,"_isAnimate",!0),Ue(r,"_center",null),Ue(r,"_raycaster",null),Ue(r,"_interactAble",!1),Ue(r,"_visible",!0),Ue(r,"_baseURL","."),Ue(r,"_pickEvent",null),Ue(r,"_intensity",.3),r._conf=Se.merge(r._conf,e),void 0===e.map||null==e.map||"function"!=typeof e.map.getContainer)throw Error("config.map invalid");if(r.map=e.map,r.container=e.container||e.map.getContainer(),!r.container)throw Error("config.container invalid");if(r._interactAble=null!==(n=e.interact)&&void 0!==n&&n,r.customCoords=r.map.customCoords,r.layer=null,delete r._conf.data,r.id=e.id||(new Date).getTime().toString(),r.title=e.title||"",e.zooms&&(r._zooms=e.zooms),void 0!==e.animate&&(r._isAnimate=e.animate),e.center)r.updateCenter(e.center),r._center=e.center;else{var i=r.map.getCenter(),a=i.lng,o=i.lat;r.updateCenter([a,o]),r._center=[a,o]}return r.reviseVisible(),"number"==typeof e.intensity&&(r._intensity=e.intensity),void 0!==e.baseURL&&(r._baseURL=e.baseURL),e.pickEvent||(r._pickEvent=e.pickEvent||"mousemove"),r.handleOnRay=Se.debounce(r.onRay,100,!0),r.bindMethods(["animate","resizeLayer","handleOnRay"]),r.camera=null,r.renderer=null,r.scene=null,r.eventMap={},r.preparea(),r}return ze(t,Je),Ne(t,[{key:"preparea",value:(r=Ee(We().mark((function e(){return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.initZooms(),this.addModuleListener(),e.next=4,this.initLayer();case 4:this.onReady(),this._initInteract(),this.animate(),this.handleEvent("complete",this);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onReady",value:function(){throw Error("该方法只能被子类重写")}},{key:"onRender",value:function(){}},{key:"update",value:function(){}},{key:"beforeDestroy",value:function(){}},{key:"createHelper",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15e3,r=new e.AxesHelper(n),i=Ke(t,3),a=i[0],o=i[1],s=i[2];r.position.set(a,o,s),this.scene.add(r)}},{key:"queryFeature",value:function(e){var t=this;return new Promise((function(n){n(t.onRay(e))}))}},{key:"destroy",value:function(){for(var e in"function"==typeof this.beforeDestroy&&this.beforeDestroy(),this.removeModuleListener(),this.layer&&(this.layer.hide(),this.map.remove(this.layer)),this.scene&&(this.scene.traverse((function(e){e.material&&e.material.dispose(),e.geometry&&e.geometry.dispose()})),this.scene=null),this.renderer&&(this.camera=null,this.renderer.clear(),this.renderer.dispose(),this.renderer=null),this)delete this[e];($e-=1)<=0&&(et.destroy(),et=null,$e=0)}},{key:"setCenter",value:function(e){this._center=e}},{key:"setVisible",value:function(e){this._conf.visible=!0===e,this.reviseVisible()}},{key:"getVisible",value:function(){return this._visible}},{key:"reviseVisible",value:function(e){var t;return(t=!!this.isInZooms()&&("boolean"!=typeof e||e))!==this._visible&&(this.handleEvent("visibleChange",t),!1===t&&this.renderer&&this.renderer.clear()),this._visible=t,this._visible}},{key:"updateCenter",value:function(e){e instanceof Array&&this.customCoords.setCenter(e),this._center=this.customCoords.getCenter()}},{key:"initThree",value:function(t){var n=this.container,r=n.clientWidth,i=n.clientHeight;this.camera=new e.PerspectiveCamera(60,r/i,100,1<<30);var a=this._conf.renderOption,o={alpha:!0,antialias:a.antialias,precision:a.precision};this._conf.alone?o.context=this._canvas.getContext("webgl"):o.context=t;var s=new e.WebGLRenderer(o);if(s.autoClear=!1,s.setClearAlpha(0),s.shadowMap.enabled=!0,s.shadowMap.type=e.PCFSoftShadowMap,s.setSize(r,i),s.setPixelRatio(window.devicePixelRatio),this.renderer=s,this.scene=new e.Scene,this._intensity>0){var u=new e.AmbientLight(16777215,this._intensity);this.scene.add(u)}}},{key:"initLayer",value:(n=Ee(We().mark((function e(){return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._conf.alone){e.next=6;break}return e.next=3,this.createCustomLayer();case 3:this.layer=e.sent,e.next=9;break;case 6:return e.next=8,this.createGlCustomLayer();case 8:this.layer=e.sent;case 9:this._conf.visible?this.layer.show():this.layer.hide();case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createCustomLayer",value:function(){var e=this;return new Promise((function(t){if(et)e._canvas=et.canvas,e.initThree(),e.updateCenter(e._center);else{var n=e.container,r=n.clientWidth,i=n.clientHeight;e._canvas=document.createElement("canvas"),e._canvas.id="gl-layers",e._canvas.width=r,e._canvas.height=i,e._canvas.style.cssText="width: ".concat(r,"px; height: ").concat(i,"px;");var a=new AMap.CustomLayer(e._canvas,{visible:!0,zIndex:e._conf.zIndex,alwaysRender:!0});e.initThree(),e.updateCenter(e._center),a.render=function(){null!=e.renderer&&e.onRender()},e.map.add(a),et=a}$e+=1,t(et)}))}},{key:"createGlCustomLayer",value:function(){var e=this;return new Promise((function(t){var n=new AMap.GLCustomLayer({zIndex:e._conf.zIndex,visible:!0,init:function(r){e.initThree(r),e.updateCenter(e._center),e.reviseVisible(),t(n)},render:function(t){e.updateCamera(),e.onRender()}});e.map.add(n)}))}},{key:"updateCamera",value:function(){var e,t,n=this.scene,r=this.renderer,i=this.camera,a=this.customCoords;if(r){r.resetState(),this._center&&a.setCenter(this._center);var o=a.getCameraParams(),s=o.near,u=o.far,l=o.fov,c=o.up,h=o.lookAt,d=o.position;i.near=s,i.far=u,i.fov=l,(e=i.position).set.apply(e,Ye(d)),(t=i.up).set.apply(t,Ye(c)),i.lookAt.apply(i,Ye(h)),i.updateProjectionMatrix(),this.composer?this.composer.render():this._visible&&r.render(n,i),r.resetState()}}},{key:"animate",value:function(e){this.renderer&&(this.update&&this.update(e),this._conf.alone?this.updateCamera():this.map&&this.map.render(),requestAnimationFrame(this.animate))}},{key:"_initInteract",value:function(){!1!==this._interactAble&&(this._raycaster=new e.Raycaster,this._pickEvent&&this.container.addEventListener(this._pickEvent,this.handleOnRay))}},{key:"onRay",value:function(e){var t=this.scene,n=this.camera;if(t){var r=this.setPickPosition(e);this._raycaster.setFromCamera(r,n);var i=this._raycaster.intersectObjects(t.children,!0);return"function"==typeof this.onPicked&&this._interactAble&&this._visible&&this.onPicked.apply(this,[{targets:i,event:e}]),i}}},{key:"setPickPosition",value:function(e){var t={x:0,y:0},n=this.container.getBoundingClientRect();return t.x=e.clientX/n.width*2-1,t.y=e.clientY/n.height*-2+1,t}},{key:"initZooms",value:function(){var e=this;this.map.on("zoomend",(function(t){e.reviseVisible()}))}},{key:"isInZooms",value:function(){var e=this.map.getZoom();return e>=this._zooms[0]&&e<=this._zooms[1]}},{key:"addModuleListener",value:function(){window.addEventListener("resize",this.resizeLayer)}},{key:"removeModuleListener",value:function(){window.removeEventListener("resize",this.resizeLayer),this._pickEvent&&this.container.removeEventListener(this._pickEvent,this.onRay)}},{key:"resizeLayer",value:function(){var e=this.container,t=e.clientWidth,n=e.clientHeight;this._canvas&&(this._canvas.width=t,this._canvas.height=n,this._canvas.style.width=t+"px",this._canvas.style.height=n+"px"),this.camera&&(this.camera.aspect=t/n)}},{key:"show",value:function(){this.layer&&(!1===this._conf.alone&&this.layer.show(),this.reviseVisible(!0))}},{key:"hide",value:function(){this.layer&&(!1===this._conf.alone&&this.layer.hide(),this.reviseVisible(!1))}},{key:"isVisible",value:function(){return!0===this._visible}},{key:"bindMethods",value:function(e){var t=this;e.forEach((function(e){t[e]=t[e].bind(t)}))}},{key:"mergeSourceURL",value:function(e){return"string"!=typeof e?(console.error('mergeSourceURL param "url" must be Sting'),null):e.startsWith("http")||e.startsWith(".")?e:"".concat(this._baseURL).concat(e)}},{key:"getResolution",value:function(){return"function"==typeof this.map.getResolution?this.map.getResolution():null}}]);var n,r}(),nt=tt,rt=function(){return Ne((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Oe(this,e),this._list=t.data||[]}),[{key:"getList",value:function(){return this._list}},{key:"add",value:function(e){if(void 0!==e)if(void 0!==e.id){var t=e.id;this.findLayerById(t)?console.error("图层的id ".concat(t," 不是唯一标识，请更换")):this._list.push(e)}else console.error("缺少图层id");else console.error("缺少图层实例")}},{key:"findLayerById",value:function(e){return this._list.find((function(t){return t.id===e}))}},{key:"remove",value:function(e){e instanceof Array||(e=[e]);var t=this._list.filter((function(t){return 0==e.includes(t.id)}));return this._list=t,t}},{key:"destroyLayerById",value:function(e){var t=this.findLayerById(e);t&&(t.destroy&&t.destroy(),this.remove(e))}},{key:"clear",value:function(){this._list.forEach((function(e){e.destroy&&e.destroy(),console.log("销毁layer ".concat(e.id))})),this._list=[]}},{key:"show",value:function(){this._list.forEach((function(e){e.show()}))}},{key:"hide",value:function(){this._list.forEach((function(e){e.hide()}))}}])}(),it=function(e){return Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase()},at=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return"rgba("+parseInt("0x"+e.slice(1,3))+","+parseInt("0x"+e.slice(3,5))+","+parseInt("0x"+e.slice(5,7))+","+t+")"},ot=function(){function t(e){var n;Oe(this,t);var r=He({altitude:0,wallHeight:50,wallColor:"#00feff",data:null,animate:!0,alphaMap:"./static/texture/texture_1.png",speed:1},e);return Ue(n=Ie(this,t,[r]),"_paths",[]),Ue(n,"_height",50),Ue(n,"_color",null),Ue(n,"_texture",null),Ue(n,"_texture_offset",0),n._height=r.wallHeight,n._color=r.wallColor,n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"onReady",value:function(){this.createWall()}},{key:"initData",value:function(e){var t=this;e.features.forEach((function(e){var n,r=e.geometry;switch(r.type){case"MultiPolygon":var i=r.coordinates[0].map((function(e){return t.customCoords.lngLatsToCoords(e)}));(n=t._paths).push.apply(n,Ye(i));break;case"Polygon":var a=t.customCoords.lngLatsToCoords(r.coordinates[0]);t._paths.push(a)}}))}},{key:"generateVecData",value:function(e){for(var t=[],n=[],r=[],i=[0,0],a=[1,0],o=[1,1],s=[0,1],u=0;u<e.length;u++){var l=Ke(e[u],2),c=l[0],h=l[1];t.push([c,h,this._conf.altitude]),t.push([c,h,this._conf.altitude+this._height])}for(var d=0;d<t.length-2;d++)d%2==0?(n=[].concat(Ye(n),Ye(t[d]),Ye(t[d+2]),Ye(t[d+1])),r=[].concat(Ye(r),i,a,s)):(n=[].concat(Ye(n),Ye(t[d]),Ye(t[d+1]),Ye(t[d+2])),r=[].concat(Ye(r),s,a,o));return{face:n,uvs:r}}},{key:"createWall",value:function(){for(var t=this.scene,n=[],r=[],i=0;i<this._paths.length;i++){var a=this.generateVecData(this._paths[i]),o=a.face,s=a.uvs;n=[].concat(Ye(n),Ye(o)),r=[].concat(Ye(r),Ye(s))}var u=new e.BufferGeometry;u.setAttribute("position",new e.BufferAttribute(new Float32Array(n),3)),u.setAttribute("uv",new e.BufferAttribute(new Float32Array(r),2));var l=new e.MeshBasicMaterial({color:this._color,side:e.DoubleSide,transparent:!0,depthWrite:!0,alphaMap:(new e.TextureLoader).load(this.mergeSourceURL(this._conf.alphaMap),(function(){}),null,(function(e){console.error("alphaMap load error")}))}),c=new e.Mesh(u,l);if(t.add(c),this.mainMesh=c,this._conf.animate){var h=u.clone();this._texture=this.generateTexture(128,this._color),this._texture.wrapS=e.RepeatWrapping,this._texture.wrapT=e.RepeatWrapping;var d=new e.MeshBasicMaterial({side:e.DoubleSide,transparent:!0,depthWrite:!1,map:this._texture}),f=new e.Mesh(h,d);t.add(f),this.animateMesh=f}}},{key:"setColor",value:function(t){var n=this.generateTexture(128,t);n.wrapS=e.RepeatWrapping,n.wrapT=e.RepeatWrapping,this._color=t,this._texture_offset=0,this.mainMesh.material.color=t,this.animateMesh.material.map=n,this._texture=n}},{key:"generateTexture",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:64,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#ff0000",r=document.createElement("canvas");r.width=t,r.height=t;var i=r.getContext("2d"),a=i.createLinearGradient(0,0,0,t);a.addColorStop(.2,at(n,0)),a.addColorStop(.8,at(n,.5)),a.addColorStop(1,at(n,1)),i.fillStyle=a,i.fillRect(0,0,t,t);var o=new e.Texture(r);return o.needsUpdate=!0,o}},{key:"update",value:function(){this._isAnimate&&(this._texture_offset<=0?this._texture_offset=1:this._texture_offset-=.03*this._conf.speed,this._texture&&this._texture.offset.set(0,this._texture_offset))}}])}();function st(e){let t,r,i,a=-1,o=0;for(let n=0;n<e.length;++n){const s=e[n];if(s.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===t&&(t=s.array.constructor),t!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===r&&(r=s.itemSize),r!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===i&&(i=s.normalized),i!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===a&&(a=s.gpuType),a!==s.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;o+=s.array.length}const s=new t(o);let u=0;for(let t=0;t<e.length;++t)s.set(e[t].array,u),u+=e[t].array.length;const l=new n(s,r,i);return void 0!==a&&(l.gpuType=a),l}function ut(e,t){if(t===r)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===i||t===a){let n=e.getIndex();if(null===n){const t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const r=n.count-2,a=[];if(t===i)for(let e=1;e<=r;e++)a.push(n.getX(0)),a.push(n.getX(e)),a.push(n.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(a.push(n.getX(e)),a.push(n.getX(e+1)),a.push(n.getX(e+2))):(a.push(n.getX(e+2)),a.push(n.getX(e+1)),a.push(n.getX(e)));a.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=e.clone();return o.setIndex(a),o.clearGroups(),o}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}function lt(e,n=!1){return console.warn("THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries()."),function(e,n=!1){const r=null!==e[0].index,i=new Set(Object.keys(e[0].attributes)),a=new Set(Object.keys(e[0].morphAttributes)),o={},s={},u=e[0].morphTargetsRelative,l=new t;let c=0;for(let t=0;t<e.length;++t){const h=e[t];let d=0;if(r!==(null!==h.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const e in h.attributes){if(!i.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===o[e]&&(o[e]=[]),o[e].push(h.attributes[e]),d++}if(d!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". Make sure all geometries have the same number of attributes."),null;if(u!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const e in h.morphAttributes){if(!a.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+".  .morphAttributes must be consistent throughout all geometries."),null;void 0===s[e]&&(s[e]=[]),s[e].push(h.morphAttributes[e])}if(n){let e;if(r)e=h.index.count;else{if(void 0===h.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". The geometry must have either an index or a position attribute"),null;e=h.attributes.position.count}l.addGroup(c,e,t),c+=e}}if(r){let t=0;const n=[];for(let r=0;r<e.length;++r){const i=e[r].index;for(let e=0;e<i.count;++e)n.push(i.getX(e)+t);t+=e[r].attributes.position.count}l.setIndex(n)}for(const e in o){const t=st(o[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" attribute."),null;l.setAttribute(e,t)}for(const e in s){const t=s[e][0].length;if(0===t)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){const t=[];for(let r=0;r<s[e].length;++r)t.push(s[e][r][n]);const r=st(t);if(!r)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" morphAttribute."),null;l.morphAttributes[e].push(r)}}return l}(e,n)}var ct="\n      varying vec2 vUv;\n      varying vec3 v_position;\n      varying vec3 vNormal; //点法线向量\n      void main() {\n          vUv = uv;\n          vNormal = normal;\n          gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n          v_position = vec3(modelMatrix * vec4(position, 1.0));\n      }\n  ",ht="   \n     varying vec2 vUv;\n     varying vec3 v_position;\n     varying vec3 vNormal;\n\n     uniform float innerCircleWidth;\n     uniform float circleWidth;\n     uniform float opacity;\n     uniform vec3 center;\n\n     uniform vec3 color;\n     uniform sampler2D topMap;\n     uniform sampler2D sideMap;\n\n     void main() {\n       float dis = length(v_position - center);\n\n       // 与波动有交集\n       if(dis < (innerCircleWidth + circleWidth) && dis > innerCircleWidth) {\n          float r = (dis - innerCircleWidth) / circleWidth;\n          if (vNormal.z > 0.0) {\n            gl_FragColor = mix(texture2D(topMap, vUv), vec4(color, opacity), r); //位于顶部\n          }else{\n            gl_FragColor = mix(texture2D(sideMap, vUv), vec4(color, opacity), r); //位于侧面\n          }          \n       }else {         \n          if (vNormal.z > 0.0) {\n            gl_FragColor = texture2D( topMap, vUv);\n          }else{\n            gl_FragColor = texture2D( sideMap, vUv);\n          }\n       }  \n     }\n  ",dt=function(){function t(e){var n;Oe(this,t);var r=He({animate:!0,zooms:[5,14],data:null,sideMap:null,topMap:null,color:null,circleWidth:50,maxRadius:1e3,circleCenter:[0,0],pulseSpeed:1,heightField:"height"},e);return Ue(n=Ie(this,t,[r]),"_data",[]),Ue(n,"_map",null),Ue(n,"_defaultHeight",50),Ue(n,"_uniforms",{topMap:{value:null},sideMap:{value:null},innerCircleWidth:{value:0},circleWidth:{value:null},color:{value:null},opacity:{value:.8},center:{value:null}}),Ue(n,"_mt",{side:null,top:null}),Ue(n,"_limitCount",0),Ue(n,"_limitMax",5e4),n.initData(r.data),n.initProps(),n}return ze(t,nt),Ne(t,[{key:"initData",value:function(e){var t=this,n=e.features,r=this._conf.heightField;this._data=JSON.parse(JSON.stringify(n)),this._data.forEach((function(e,n){var i=e.geometry,a=e.properties,o=i.type,s=i.coordinates;"MultiPolygon"===o&&(e.geometry.coordinates=s.map((function(e){return t.customCoords.lngLatsToCoords(e)}))),"Polygon"===o&&(e.geometry.coordinates=t.customCoords.lngLatsToCoords(s)),e.properties.height=a[r]})),console.log(this._data)}},{key:"initProps",value:function(){var t=this._conf,n=this._uniforms;if(this._baseURL,t.sideMap?n.sideMap.value=t.sideMap:n.sideMap.value=(new e.TextureLoader).load(this.mergeSourceURL("./static/texture/texture_building_1.png")),t.topMap)n.topMap.value=t.topMap;else{var r=(new e.TextureLoader).load(this.mergeSourceURL("./static/texture/texture_building_2.png"));n.topMap.value=r}n.color.value=t.color||new e.Color(5563129),n.circleWidth.value=t.circleWidth,n.center.value=new e.Vector3(this._conf.circleCenter[0],this._conf.circleCenter[1],0)}},{key:"onReady",value:function(){this.initMt(),this.createPolygon()}},{key:"initMt",value:function(){var t=ct,n=ht,r=this._uniforms,i=r.sideMap,a=r.topMap,o=r.innerCircleWidth,s=r.circleWidth,u=r.color,l=r.opacity,c=r.center;this._mt=new e.ShaderMaterial({uniforms:{topMap:a,sideMap:i,innerCircleWidth:o,circleWidth:s,color:u,opacity:l,center:c},vertexShader:t,fragmentShader:n,side:e.DoubleSide,depthTest:!0,transparent:!0})}},{key:"createPolygon",value:function(){var t=this,n=[],r=[];this._data.forEach((function(e,i){var a=e.geometry,o=e.properties,s=a.type,u=a.coordinates;if("Polygon"===s){var l=t._createPolygon(u,o),c=l.sides,h=l.tops;n=n.concat(c),r=r.concat(h)}"MultiPolygon"===s&&u.forEach((function(e){var i=t._createPolygon(e,o),a=i.sides,s=i.tops;n=n.concat(a),r=r.concat(s)}))}));var i=new e.Mesh(lt(n,!1),this._mt);this.scene.add(i);var a=new e.Mesh(lt(r,!1),this._mt);this.scene.add(a)}},{key:"_createPolygon",value:function(){var e=this,t=arguments.length>1?arguments[1]:void 0,n=[],r=[];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((function(i){if(!(e._limitCount>=e._limitMax)){var a=e.drawSide(i,t);n.push(a);var o=e.drawTop(i,t);r.push(o),e._limitCount++}})),{sides:n,tops:r}}},{key:"drawSide",value:function(e,t){var n=t.height;return t.name,t.fill,this.createSideGeometry(e,n||this._defaultHeight)}},{key:"drawTop",value:function(t,n){var r=n.height;n.name;var i=new e.Shape;t.forEach((function(e,t){var n=Ke(e,2),r=n[0],a=n[1];0===t?i.moveTo(r,a):i.lineTo(r,a)}));var a=new e.ShapeGeometry(i),o=r||this._defaultHeight;return a.attributes.position.array.forEach((function(e,t){(t+1)%3==0&&(a.attributes.position.array[t]=o)})),a}},{key:"createSideGeometry",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t instanceof Array==!1)throw"createSideGeometry: path must be array";t[0].toString()!==t[t.length-1].toString()&&t.push(t[0]);for(var r=[],i=[],a=[],o=[0,0],s=[1,0],u=[1,1],l=[0,1],c=0;c<t.length;c++){var h=Ke(t[c],2),d=h[0],f=h[1];r.push([d,f,0]),r.push([d,f,n])}for(var p=0;p<r.length-2;p++)p%2==0?(i=[].concat(Ye(i),Ye(r[p]),Ye(r[p+2]),Ye(r[p+1])),a=[].concat(Ye(a),o,s,l)):(i=[].concat(Ye(i),Ye(r[p]),Ye(r[p+1]),Ye(r[p+2])),a=[].concat(Ye(a),l,s,u));var v=new e.BufferGeometry;return v.setAttribute("position",new e.BufferAttribute(new Float32Array(i),3)),v.setAttribute("uv",new e.BufferAttribute(new Float32Array(a),2)),v}},{key:"update",value:function(){if(this._isAnimate){var e=this._uniforms,t=e.innerCircleWidth;e.circleWidth,e.opacity,t.value+=10*this._conf.pulseSpeed,t.value>this._conf.maxRadius&&(t.value=0)}}},{key:"setSweepStyle",value:function(e){this._uniforms.center.value=e.center}}])}(),ft=function(){function t(e){var n;Oe(this,t);var r=He({animate:!0,zooms:[5,14],data:null,interact:!0,style:{initial:{color:"#ffffff",opacity:.3},hover:{color:"#ff0000",opacity:.8}}},e);return Ue(n=Ie(this,t,[r]),"_data",[]),Ue(n,"_map",null),Ue(n,"_mt",null),n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"initData",value:function(e){var t=this,n=e.features;this._data=JSON.parse(JSON.stringify(n)),this._data.forEach((function(e,n){var r=e.geometry,i=r.type,a=r.coordinates;"MultiPolygon"===i&&(e.geometry.coordinates=a.map((function(e){return t.customCoords.lngLatsToCoords(e)}))),"Polygon"===i&&(e.geometry.coordinates=t.customCoords.lngLatsToCoords(a))})),console.log(this._data)}},{key:"onReady",value:function(){this.initMaterial(),this.createPolygon()}},{key:"onPicked",value:function(e){var t,n,r=e.targets,i=e.event,a=null;if(r.length>0){var o,s=null===(o=r[0])||void 0===o?void 0:o.object;"Mesh"==(null==s?void 0:s.type)?(this.setLastPick(s),a=s._attrs):this.removeLastPick()}else this.removeLastPick();this.handleEvent("pick",{screenX:null==i||null===(t=i.pixel)||void 0===t?void 0:t.x,screenY:null==i||null===(n=i.pixel)||void 0===n?void 0:n.y,attrs:a})}},{key:"setLastPick",value:function(e){var t=this._lastPick;this.scene,e&&(t&&t&&JSON.stringify(null==t?void 0:t._attrs)===JSON.stringify(null==e?void 0:e._attrs)||(this.removeLastPick(),e.material=this._mt.hover,this._lastPick=e))}},{key:"removeLastPick",value:function(){var e=this._lastPick;this.scene,e&&(e.material=this._mt.initial,this._lastPick=null)}},{key:"initMaterial",value:function(){var t=this._conf.style,n=t.initial,r=t.hover;this._mt={},this._mt.initial=new e.MeshBasicMaterial({color:n.color,transparent:!0,opacity:n.opacity,side:e.DoubleSide,wireframe:!1}),this._mt.hover=new e.MeshBasicMaterial({color:r.color,transparent:!0,opacity:r.opacity,side:e.DoubleSide})}},{key:"createPolygon",value:function(){var t=this,n=this._mt.initial,r=[],i=[];this._data.forEach((function(e,n){var a=e.geometry,o=e.properties,s=a.type,u=a.coordinates;if("Polygon"===s){var l=t._createPolygon(u,o),c=l.sides,h=l.tops;r=r.concat(c),i=i.concat(h)}"MultiPolygon"===s&&u.forEach((function(e){var n=t._createPolygon(e,o),a=n.sides,s=n.tops;r=r.concat(a),i=i.concat(s)}))})),r.forEach((function(r){var i=new e.Mesh(r,n);i._attrs=r._attrs,delete r._attrs,t.scene.add(i)}))}},{key:"_createPolygon",value:function(){var e=this,t=arguments.length>1?arguments[1]:void 0,n=[],r=[];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((function(i){var a=e.drawSide(i,t);n=[].concat(Ye(n),Ye(a));var o=e.drawTop(i,t);r=[].concat(Ye(r),Ye(o))})),{sides:n,tops:r}}},{key:"drawSide",value:function(e,t){for(var n=t.regions,r=[],i=0;i<=n.length-1;i++){var a=this.createSideGeometry(e,n[i]);a._attrs=He({},n[i]),r.push(a)}return r}},{key:"drawTop",value:function(t,n){for(var r=n.regions,i=[],a=function(){var n=new e.Shape,a=r[o],s=a.bottomAltitude,u=a.extendAltitude;t.forEach((function(e,t){var r=Ke(e,2),i=r[0],a=r[1];0===t?n.moveTo(i,a):n.lineTo(i,a)}));var l=new e.ShapeGeometry(n),c=s+u;l.attributes.position.array.forEach((function(e,t){(t+1)%3==0&&(l.attributes.position.array[t]=c)})),i.push(l)},o=0;o<=r.length-1;o++)a();return i}},{key:"createSideGeometry",value:function(t,n){if(t instanceof Array==!1)throw"createSideGeometry: path must be array";n.id;var r=n.bottomAltitude,i=n.extendAltitude;t[0].toString()!==t[t.length-1].toString()&&t.push(t[0]);for(var a=[],o=[],s=[],u=[0,0],l=[1,0],c=[1,1],h=[0,1],d=0;d<t.length;d++){var f=Ke(t[d],2),p=f[0],v=f[1];a.push([p,v,r]),a.push([p,v,r+i])}for(var m=0;m<a.length-2;m++)m%2==0?(o=[].concat(Ye(o),Ye(a[m]),Ye(a[m+2]),Ye(a[m+1])),s=[].concat(Ye(s),u,l,h)):(o=[].concat(Ye(o),Ye(a[m]),Ye(a[m+1]),Ye(a[m+2])),s=[].concat(Ye(s),h,l,c));var g=new e.BufferGeometry;return g.setAttribute("position",new e.BufferAttribute(new Float32Array(o),3)),g.setAttribute("uv",new e.BufferAttribute(new Float32Array(s),2)),g}},{key:"update",value:function(){}}])}(),pt=Object.defineProperty,vt=function(e,t,n){return function(e,t,n){t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!==Ze(t)?t+"":t,n),n};function mt(e,t,n,r,i){var a;if(e=e.subarray||e.slice?e:e.buffer,n=n.subarray||n.slice?n:n.buffer,e=t?e.subarray?e.subarray(t,i&&t+i):e.slice(t,i&&t+i):e,n.set)n.set(e,r);else for(a=0;a<e.length;a++)n[a+r]=e[a];return n}var gt=function(){function t(){var n;return Oe(this,t),n=Ie(this,t),vt(n,"type","MeshLine"),vt(n,"isMeshLine",!0),vt(n,"positions",[]),vt(n,"previous",[]),vt(n,"next",[]),vt(n,"side",[]),vt(n,"width",[]),vt(n,"indices_array",[]),vt(n,"uvs",[]),vt(n,"counters",[]),vt(n,"widthCallback",null),vt(n,"_attributes"),vt(n,"_points",[]),vt(n,"points"),vt(n,"matrixWorld",new e.Matrix4),Object.defineProperties(n,{points:{enumerable:!0,get:function(){return this._points},set:function(e){this.setPoints(e,this.widthCallback)}}}),n}return ze(t,e.BufferGeometry),Ne(t,[{key:"setMatrixWorld",value:function(e){this.matrixWorld=e}},{key:"setPoints",value:function(t,n){if(t=function(t){return t instanceof Float32Array?t:t instanceof e.BufferGeometry?t.getAttribute("position").array:t.map((function(t){var n=Array.isArray(t);return t instanceof e.Vector3?[t.x,t.y,t.z]:t instanceof e.Vector2?[t.x,t.y,0]:n&&3===t.length?[t[0],t[1],t[2]]:n&&2===t.length?[t[0],t[1],0]:t})).flat()}(t),this._points=t,this.widthCallback=null!=n?n:null,this.positions=[],this.counters=[],t.length&&t[0]instanceof e.Vector3)for(var r=0;r<t.length;r++){var i=t[r],a=r/(t.length-1);this.positions.push(i.x,i.y,i.z),this.positions.push(i.x,i.y,i.z),this.counters.push(a),this.counters.push(a)}else for(var o=0;o<t.length;o+=3){var s=o/(t.length-1);this.positions.push(t[o],t[o+1],t[o+2]),this.positions.push(t[o],t[o+1],t[o+2]),this.counters.push(s),this.counters.push(s)}this.process()}},{key:"compareV3",value:function(e,t){var n=6*e,r=6*t;return this.positions[n]===this.positions[r]&&this.positions[n+1]===this.positions[r+1]&&this.positions[n+2]===this.positions[r+2]}},{key:"copyV3",value:function(e){var t=6*e;return[this.positions[t],this.positions[t+1],this.positions[t+2]]}},{key:"process",value:function(){var t,n,r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],n=this.compareV3(0,r-1)?this.copyV3(r-2):this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),t=this.widthCallback?this.widthCallback(i/(r-1)):1,this.width.push(t),this.width.push(t),this.uvs.push(i/(r-1),0),this.uvs.push(i/(r-1),1),i<r-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var a=2*i;this.indices_array.push(a,a+1,a+2),this.indices_array.push(a+2,a+1,a+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}n=this.compareV3(r-1,0)?this.copyV3(1):this.copyV3(r-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),this._attributes&&this._attributes.position.count===this.positions.length?(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0):this._attributes={position:new e.BufferAttribute(new Float32Array(this.positions),3),previous:new e.BufferAttribute(new Float32Array(this.previous),3),next:new e.BufferAttribute(new Float32Array(this.next),3),side:new e.BufferAttribute(new Float32Array(this.side),1),width:new e.BufferAttribute(new Float32Array(this.width),1),uv:new e.BufferAttribute(new Float32Array(this.uvs),2),index:new e.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new e.BufferAttribute(new Float32Array(this.counters),1)},this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()}},{key:"advance",value:function(e){var t=e.x,n=e.y,r=e.z,i=this._attributes.position.array,a=this._attributes.previous.array,o=this._attributes.next.array,s=i.length;mt(i,0,a,0,s),mt(i,6,i,0,s-6),i[s-6]=t,i[s-5]=n,i[s-4]=r,i[s-3]=t,i[s-2]=n,i[s-1]=r,mt(i,6,o,0,s-6),o[s-6]=t,o[s-5]=n,o[s-4]=r,o[s-3]=t,o[s-2]=n,o[s-1]=r,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0}}])}(),yt=function(){function t(n){var r;return Oe(this,t),r=Ie(this,t,[{uniforms:He(He({},e.UniformsLib.fog),{},{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new e.Color(16777215)},opacity:{value:1},resolution:{value:new e.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new e.Vector2(1,1)},offset:{value:new e.Vector2(1,1)}}),vertexShader:"\n  #include <common>\n  #include <logdepthbuf_pars_vertex>\n  #include <fog_pars_vertex>\n\n  attribute vec3 previous;\n  attribute vec3 next;\n  attribute float side;\n  attribute float width;\n  attribute float counters;\n  \n  uniform vec2 resolution;\n  uniform float lineWidth;\n  uniform vec3 color;\n  uniform float opacity;\n  uniform float sizeAttenuation;\n  uniform vec2 offset;\n  \n  varying vec2 vUV;\n  varying vec4 vColor;\n  varying float vCounters;\n  \n  vec2 fix(vec4 i, float aspect) {\n    vec2 res = i.xy / i.w;\n    res.x *= aspect;\n  \tvCounters = counters;\n    return res;\n  }\n  \n  void main() {\n    float aspect = resolution.x / resolution.y;\n    vColor = vec4(color, opacity);\n    vUV = uv + offset;\n  \n    mat4 m = projectionMatrix * modelViewMatrix;\n    vec4 finalPosition = m * vec4(position, 1.0);\n    vec4 prevPos = m * vec4(previous, 1.0);\n    vec4 nextPos = m * vec4(next, 1.0);\n  \n    vec2 currentP = fix(finalPosition, aspect);\n    vec2 prevP = fix(prevPos, aspect);\n    vec2 nextP = fix(nextPos, aspect);\n  \n    float w = lineWidth * width;\n  \n    vec2 dir;\n    if (nextP == currentP) dir = normalize(currentP - prevP);\n    else if (prevP == currentP) dir = normalize(nextP - currentP);\n    else {\n      vec2 dir1 = normalize(currentP - prevP);\n      vec2 dir2 = normalize(nextP - currentP);\n      dir = normalize(dir1 + dir2);\n  \n      vec2 perp = vec2(-dir1.y, dir1.x);\n      vec2 miter = vec2(-dir.y, dir.x);\n      //w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width);\n    }\n  \n    //vec2 normal = (cross(vec3(dir, 0.), vec3(0., 0., 1.))).xy;\n    vec4 normal = vec4(-dir.y, dir.x, 0., 1.);\n    normal.xy *= .5 * w;\n    //normal *= projectionMatrix;\n    if (sizeAttenuation == 0.) {\n      normal.xy *= finalPosition.w;\n      normal.xy /= (vec4(resolution, 0., 1.) * projectionMatrix).xy;\n    }\n  \n    finalPosition.xy += normal.xy * side;\n    gl_Position = finalPosition;\n    #include <logdepthbuf_vertex>\n    #include <fog_vertex>\n    vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n    #include <fog_vertex>\n  }\n",fragmentShader:"\n  #include <fog_pars_fragment>\n  #include <logdepthbuf_pars_fragment>\n  \n  uniform sampler2D map;\n  uniform sampler2D alphaMap;\n  uniform float useMap;\n  uniform float useAlphaMap;\n  uniform float useDash;\n  uniform float dashArray;\n  uniform float dashOffset;\n  uniform float dashRatio;\n  uniform float visibility;\n  uniform float alphaTest;\n  uniform vec2 repeat;\n  \n  varying vec2 vUV;\n  varying vec4 vColor;\n  varying float vCounters;\n  \n  void main() {\n    #include <logdepthbuf_fragment>\n    vec4 c = vColor;\n    if (useMap == 1.) c *= texture2D(map, vUV * repeat);\n    if (useAlphaMap == 1.) c.a *= texture2D(alphaMap, vUV * repeat).a;\n    if (c.a < alphaTest) discard;\n    if (useDash == 1.) {\n      c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));\n    }\n    gl_FragColor = c;\n    gl_FragColor.a *= step(vCounters, visibility);\n    #include <fog_fragment>\n    #include <tonemapping_fragment>\n    #include <encodings_fragment>\n  }\n"}]),vt(r,"lineWidth"),vt(r,"map"),vt(r,"useMap"),vt(r,"alphaMap"),vt(r,"useAlphaMap"),vt(r,"color"),vt(r,"resolution"),vt(r,"sizeAttenuation"),vt(r,"dashArray"),vt(r,"dashOffset"),vt(r,"dashRatio"),vt(r,"useDash"),vt(r,"visibility"),vt(r,"repeat"),r.type="MeshLineMaterial",Object.defineProperties(r,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=0!==e?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}}}),r.setValues(n),r}return ze(t,e.ShaderMaterial),Ne(t,[{key:"copy",value:function(e){var n,r,i,a,o;return(n=t,r="copy",i=this,o=Fe(Be(1&(a=3)?n.prototype:n),r,i),2&a&&"function"==typeof o?function(e){return o.apply(i,e)}:o)([e]),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray=e.dashArray,this.dashOffset=e.dashOffset,this.dashRatio=e.dashRatio,this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}}])}(),_t=function(){function t(e){var n;Oe(this,t);var r=He({data:null,opacity:1,altitude:0,animate:!1,speed:2,topMap:"./static/texture/rock1.jpg",topMapNormal:"./static/texture/rock1-normal.jpg",topColor:"#0d8ce7",topMapRepeat:[1e-4,1e-4],sideMap:"./static/texture/texture_cake_1.png",borderColor:"#10ecda",borderWidth:300,borderMap:void 0},e);return Ue(n=Ie(this,t,[r]),"_paths",[]),Ue(n,"_borderMaterial",null),void 0===r.data?(console.log("props data is required"),je(n)):(n.initData(r.data),n._data=r.data,n)}return ze(t,nt),Ne(t,[{key:"initLight",value:function(){var t=new e.AmbientLight(16777215,.2);this.scene.add(t)}},{key:"onReady",value:function(){this.initLight(),this.initArea()}},{key:"initData",value:function(e){var t=this;e.features.forEach((function(e){e.geometry.coordinates.forEach((function(e){var n=e[0][0]instanceof Array?e[0]:e,r=t.customCoords.lngLatsToCoords(n);t._paths.push(r)}))}))}},{key:"initArea",value:function(){var e=this,t=this._data.features,n=this._conf.borderWidth;t.forEach((function(t,r){var i=e._paths[r],a=t.properties;e.drawSide(i,a),e.drawOneArea(i,a),n>0&&e.drawBorder(i,a)}))}},{key:"drawOneArea",value:function(t,n){var r=n.height;n.name;var i=this.scene,a=this._conf.altitude,o=new e.Shape;t.forEach((function(e,t){var n=Ke(e,2),r=n[0],i=n[1];0===t?o.moveTo(r,i):o.lineTo(r,i)}));var s=new e.ShapeGeometry(o),u=new e.Mesh(s,this.getMaterial());u.position.z=a+r||0,i.add(u)}},{key:"getMaterial",value:function(){var t=this._conf,n=t.topColor,r=t.topMap,i=t.topMapNormal,a=t.opacity,o=t.topMapRepeat,s=new e.MeshPhongMaterial({side:e.DoubleSide,transparent:!0,depthWrite:!0,color:n,opacity:a});if(r){var u=Ke(o,2),l=u[0],c=u[1],h=(new e.TextureLoader).load(this.mergeSourceURL(r),(function(){}),null,(function(){console.error("topMap load error")}));h.wrapS=e.RepeatWrapping,h.wrapT=e.RepeatWrapping,h.repeat.set(l,c);var d=(new e.TextureLoader).load(this.mergeSourceURL(i),(function(){}),null,(function(){console.error("topMapNormal load error")}));h.wrapS=e.RepeatWrapping,h.wrapT=e.RepeatWrapping,h.repeat.set(l,c),s.map=h,s.normalMap=d}return s}},{key:"drawSide",value:function(t,n){var r=n.height,i=void 0===r?0:r;if(n.name,!(i<=0)){var a=this._conf.altitude,o=t;o[0].toString()!==o[o.length-1].toString()&&o.push(o[0]);for(var s=[],u=[],l=[],c=[0,0],h=[1,0],d=[1,1],f=[0,1],p=0;p<o.length;p++){var v=Ke(o[p],2),m=v[0],g=v[1];s.push([m,g,a]),s.push([m,g,a+i])}for(var y=0;y<s.length-2;y++)y%2==0?(u=[].concat(Ye(u),Ye(s[y]),Ye(s[y+2]),Ye(s[y+1])),l=[].concat(Ye(l),c,h,f)):(u=[].concat(Ye(u),Ye(s[y]),Ye(s[y+1]),Ye(s[y+2])),l=[].concat(Ye(l),f,h,d));var _=new e.BufferGeometry;_.setAttribute("position",new e.BufferAttribute(new Float32Array(u),3)),_.setAttribute("uv",new e.BufferAttribute(new Float32Array(l),2));var x=new e.MeshBasicMaterial({side:e.DoubleSide,transparent:!0,depthWrite:!0});if(this._conf.sideMap){var w=(new e.TextureLoader).load(this._conf.sideMap,(function(){}),null,(function(){console.error("sideMap load error")}));w.wrapS=e.RepeatWrapping,w.wrapT=e.RepeatWrapping,w.offset.set(0,1),x.map=w}var b=new e.Mesh(_,x);this.scene.add(b)}}},{key:"drawBorder",value:function(t,n){var r=n.height;n.name;var i=this._conf.altitude,a=t.map((function(t){var n=Ke(t,2),a=n[0],o=n[1];return new e.Vector3(a,o,i+1.01*r)})),o=new gt;o.setPoints(a);var s=new e.Mesh(o,this.getBorderMaterial());this.scene.add(s)}},{key:"getBorderMaterial",value:function(){if(null==this._borderMaterial){var t,n=this._conf,r=n.borderWidth,i=n.borderColor,a=n.borderMap,o=new yt({lineWidth:r,sizeAttenuation:1,useMap:a?1:0,opacity:1,transparent:!1});a?((t=(new e.TextureLoader).load(this._conf.borderMap,(function(){}),null,(function(){console.error("borderMap load error")}))).wrapS=e.RepeatWrapping,t.wrapT=e.RepeatWrapping,o.map=t):o.color=new e.Color(i),this._borderMaterial=o}return this._borderMaterial}},{key:"update",value:function(){this._isAnimate&&this._borderMaterial&&(this._borderMaterial.uniforms.offset.value.x+=.005)}}])}();class xt extends o{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new kt(e)})),this.register((function(e){return new Ot(e)})),this.register((function(e){return new Dt(e)})),this.register((function(e){return new Nt(e)})),this.register((function(e){return new Ct(e)})),this.register((function(e){return new Rt(e)})),this.register((function(e){return new Lt(e)})),this.register((function(e){return new Pt(e)})),this.register((function(e){return new Tt(e)})),this.register((function(e){return new Et(e)})),this.register((function(e){return new St(e)})),this.register((function(e){return new It(e)})),this.register((function(e){return new At(e)})),this.register((function(e){return new Ut(e)})),this.register((function(e){return new Ft(e)}))}load(e,t,n,r){const i=this;let a;a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:s.extractUrlBase(e),this.manager.itemStart(e);const o=function(t){r?r(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},l=new u(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(n){try{i.parse(n,a,(function(n){t(n),i.manager.itemEnd(e)}),o)}catch(e){o(e)}}),n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let i;const a={},o={},s=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===Bt){try{a[bt.KHR_BINARY_GLTF]=new Vt(e)}catch(e){return void(r&&r(e))}i=JSON.parse(a[bt.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(void 0===i.asset||i.asset.version[0]<2)return void(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const u=new pn(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](u);o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){const t=i.extensionsUsed[e],n=i.extensionsRequired||[];switch(t){case bt.KHR_MATERIALS_UNLIT:a[t]=new Mt;break;case bt.KHR_DRACO_MESH_COMPRESSION:a[t]=new Ht(i,this.dracoLoader);break;case bt.KHR_TEXTURE_TRANSFORM:a[t]=new jt;break;case bt.KHR_MESH_QUANTIZATION:a[t]=new Wt;break;default:n.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}u.setExtensions(a),u.setPlugins(o),u.parse(n,r)}parseAsync(e,t){const n=this;return new Promise((function(r,i){n.parse(e,t,r,i)}))}}function wt(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const bt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class At{constructor(e){this.parser=e,this.name=bt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){const r=t[n];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let r=t.cache.get(n);if(r)return r;const i=t.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let o;const s=new l(16777215);void 0!==a.color&&s.setRGB(a.color[0],a.color[1],a.color[2],c);const u=void 0!==a.range?a.range:0;switch(a.type){case"directional":o=new f(s),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new d(s),o.distance=u;break;case"spot":o=new h(s),o.distance=u,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),o.decay=2,un(o,a),void 0!==a.intensity&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),r=Promise.resolve(o),t.cache.add(n,r),r}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(e){return n._getNodeRef(t.cache,i,e)}))}}class Mt{constructor(){this.name=bt.KHR_MATERIALS_UNLIT}getMaterialType(){return p}extendParams(e,t,n){const r=[];e.color=new l(1,1,1),e.opacity=1;const i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],c),e.opacity=t[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(e,"map",i.baseColorTexture,v))}return Promise.all(r)}}class Tt{constructor(e){this.parser=e,this.name=bt.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}class kt{constructor(e){this.parser=e,this.name=bt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?m:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],a=r.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){const e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new g(e,e)}return Promise.all(i)}}class St{constructor(e){this.parser=e,this.name=bt.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?m:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],a=r.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&i.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&i.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(i)}}class Ct{constructor(e){this.parser=e,this.name=bt.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?m:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[];t.sheenColor=new l(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=r.extensions[this.name];if(void 0!==a.sheenColorFactor){const e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],c)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&i.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,v)),void 0!==a.sheenRoughnessTexture&&i.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(i)}}class Rt{constructor(e){this.parser=e,this.name=bt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?m:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],a=r.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&i.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(i)}}class Lt{constructor(e){this.parser=e,this.name=bt.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?m:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],a=r.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&i.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=(new l).setRGB(o[0],o[1],o[2],c),Promise.all(i)}}class Pt{constructor(e){this.parser=e,this.name=bt.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?m:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class Et{constructor(e){this.parser=e,this.name=bt.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?m:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],a=r.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&i.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=(new l).setRGB(o[0],o[1],o[2],c),void 0!==a.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,v)),Promise.all(i)}}class It{constructor(e){this.parser=e,this.name=bt.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?m:null}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],a=r.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&i.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(i)}}class Ot{constructor(e){this.parser=e,this.name=bt.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,a)}}class Dt{constructor(e){this.parser=e,this.name=bt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;const a=i.extensions[t],o=r.images[a.source];let s=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a.source,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Nt{constructor(e){this.parser=e,this.name=bt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;const a=i.extensions[t],o=r.images[a.source];let s=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a.source,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Ut{constructor(e){this.name=bt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then((function(t){const n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then((function(e){return e.buffer})):i.ready.then((function(){const t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t}))}))}return null}}class Ft{constructor(e){this.name=bt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const r=t.meshes[n.mesh];for(const e of r.primitives)if(e.mode!==Qt.TRIANGLES&&e.mode!==Qt.TRIANGLE_STRIP&&e.mode!==Qt.TRIANGLE_FAN&&void 0!==e.mode)return null;const i=n.extensions[this.name].attributes,a=[],o={};for(const e in i)a.push(this.parser.getDependency("accessor",i[e]).then((t=>(o[e]=t,o[e]))));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then((e=>{const t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(const e of n){const t=new y,n=new _,a=new x,s=new _(1,1,1),u=new w(e.geometry,e.material,r);for(let e=0;e<r;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),u.setMatrixAt(e,t.compose(n,a,s));for(const t in o)"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,o[t]);b.prototype.copy.call(u,e),this.parser.assignFinalMaterial(u),i.push(u)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]})))}}const Bt="glTF",zt=1313821514,Gt=5130562;class Vt{constructor(e){this.name=bt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Bt)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,i=new DataView(e,12);let a=0;for(;a<r;){const t=i.getUint32(a,!0);a+=4;const r=i.getUint32(a,!0);if(a+=4,r===zt){const r=new Uint8Array(e,12+a,t);this.content=n.decode(r)}else if(r===Gt){const n=12+a;this.body=e.slice(n,n+t)}a+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Ht{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=bt.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},u={};for(const e in a){const t=en[e]||e.toLowerCase();o[t]=a[e]}for(const t in e.attributes){const r=en[t]||t.toLowerCase();if(void 0!==a[t]){const i=n.accessors[e.attributes[t]],a=Zt[i.componentType];u[r]=a.name,s[r]=!0===i.normalized}}return t.getDependency("bufferView",i).then((function(e){return new Promise((function(t){r.decodeDracoFile(e,(function(e){for(const t in e.attributes){const n=e.attributes[t],r=s[t];void 0!==r&&(n.normalized=r)}t(e)}),o,u)}))}))}}class jt{constructor(){this.name=bt.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class Wt{constructor(){this.name=bt.KHR_MESH_QUANTIZATION}}class Xt extends he{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}interpolate_(e,t,n,r){const i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,u=3*o,l=r-t,c=(n-t)/l,h=c*c,d=h*c,f=e*u,p=f-u,v=-2*d+3*h,m=d-h,g=1-v,y=m-h+c;for(let e=0;e!==o;e++){const t=a[p+e+o],n=a[p+e+s]*l,r=a[f+e+o],u=a[f+e]*l;i[e]=g*t+y*n+v*r+m*u}return i}}const Kt=new x;class Yt extends Xt{interpolate_(e,t,n,r){const i=super.interpolate_(e,t,n,r);return Kt.fromArray(i).normalize().toArray(i),i}}const Qt={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Zt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},qt={9728:q,9729:S,9984:J,9985:$,9986:ee,9987:C},Jt={33071:te,33648:ne,10497:R},$t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},en={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},tn={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},nn={CUBICSPLINE:void 0,LINEAR:Q,STEP:re},rn="OPAQUE",an="MASK",on="BLEND";function sn(e,t,n){for(const r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function un(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ln(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function cn(e){let t;const n=e.extensions&&e.extensions[bt.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+hn(n.attributes):e.indices+":"+hn(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,r=e.targets.length;n<r;n++)t+=":"+hn(e.targets[n]);return t}function hn(e){let t="";const n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function dn(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const fn=new y;class pn{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new wt,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=!1,i=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=navigator.userAgent.indexOf("Firefox")>-1,i=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||r&&i<98?this.textureLoader=new A(this.options.manager):this.textureLoader=new M(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new u(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){const a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return sn(i,a,r),un(a,r),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){const r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){const r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(n[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const r=n.clone(),i=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const r=e(t[n]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let r=0;r<t.length;r++){const i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){const n=e+":"+t;let r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)})),!r)throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return n.getDependency(e,r)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[bt.KHR_BINARY_GLTF].body);const r=this.options;return new Promise((function(e,i){n.load(s.resolveURL(t.uri,r.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))}loadAccessor(e){const t=this,r=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=$t[i.type],t=Zt[i.componentType],r=!0===i.normalized,a=new t(i.count*e);return Promise.resolve(new n(a,e,r))}const a=[];return void 0!==i.bufferView?a.push(this.getDependency("bufferView",i.bufferView)):a.push(null),void 0!==i.sparse&&(a.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(a).then((function(e){const a=e[0],o=$t[i.type],s=Zt[i.componentType],u=s.BYTES_PER_ELEMENT,l=u*o,c=i.byteOffset||0,h=void 0!==i.bufferView?r.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized;let f,p;if(h&&h!==l){const e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let r=t.cache.get(n);r||(f=new s(a,e*h,i.count*h/u),r=new T(f,h/u),t.cache.add(n,r)),p=new k(r,o,c%h/u,d)}else f=null===a?new s(i.count*o):new s(a,c,i.count*o),p=new n(f,o,d);if(void 0!==i.sparse){const t=$t.SCALAR,r=Zt[i.sparse.indices.componentType],u=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new r(e[1],u,i.sparse.count*t),h=new s(e[2],l,i.sparse.count*o);null!==a&&(p=new n(p.array.slice(),p.itemSize,p.normalized));for(let e=0,t=c.length;e<t;e++){const t=c[e];if(p.setX(t,h[e*o]),o>=2&&p.setY(t,h[e*o+1]),o>=3&&p.setZ(t,h[e*o+2]),o>=4&&p.setW(t,h[e*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r];let a=this.textureLoader;if(i.uri){const e=n.manager.getHandler(i.uri);null!==e&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){const r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];const u=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);const n=(i.samplers||{})[a.sampler]||{};return t.magFilter=qt[n.magFilter]||S,t.minFilter=qt[n.minFilter]||C,t.wrapS=Jt[n.wrapS]||R,t.wrapT=Jt[n.wrapT]||R,r.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[s]=u,u}loadImageSource(e,t){const n=this,r=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const a=r.images[e],o=self.URL||self.webkitURL;let u=a.uri||"",l=!1;if(void 0!==a.bufferView)u=n.getDependency("bufferView",a.bufferView).then((function(e){l=!0;const t=new Blob([e],{type:a.mimeType});return u=o.createObjectURL(t),u}));else if(void 0===a.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(u).then((function(e){return new Promise((function(n,r){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){const t=new ae(e);t.needsUpdate=!0,n(t)}),t.load(s.resolveURL(e,i.path),a,void 0,r)}))})).then((function(e){var t;return!0===l&&o.revokeObjectURL(u),e.userData.mimeType=a.mimeType||((t=a.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",u),e}));return this.sourceCache[e]=c,c}assignTexture(e,t,n,r){const i=this;return this.getDependency("texture",n.index).then((function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),i.extensions[bt.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[bt.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=i.associations.get(a);a=i.extensions[bt.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==r&&(a.colorSpace=r),e[t]=a,a}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const r=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new L,P.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new E,P.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e="ClonedMaterial:"+n.uuid+":";r&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return I}loadMaterial(e){const t=this,n=this.json,r=this.extensions,i=n.materials[e];let a;const o={},s=[];if((i.extensions||{})[bt.KHR_MATERIALS_UNLIT]){const e=r[bt.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),s.push(e.extendParams(o,i,t))}else{const n=i.pbrMetallicRoughness||{};if(o.color=new l(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],c),o.opacity=e[3]}void 0!==n.baseColorTexture&&s.push(t.assignTexture(o,"map",n.baseColorTexture,v)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(s.push(t.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),s.push(t.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),s.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===i.doubleSided&&(o.side=O);const u=i.alphaMode||rn;if(u===on?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,u===an&&(o.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&a!==p&&(s.push(t.assignTexture(o,"normalMap",i.normalTexture)),o.normalScale=new g(1,1),void 0!==i.normalTexture.scale)){const e=i.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==i.occlusionTexture&&a!==p&&(s.push(t.assignTexture(o,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(o.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&a!==p){const e=i.emissiveFactor;o.emissive=(new l).setRGB(e[0],e[1],e[2],c)}return void 0!==i.emissiveTexture&&a!==p&&s.push(t.assignTexture(o,"emissiveMap",i.emissiveTexture,v)),Promise.all(s).then((function(){const n=new a(o);return i.name&&(n.name=i.name),un(n,i),t.associations.set(n,{materials:e}),i.extensions&&sn(r,n,i),n}))}createUniqueName(e){const t=D.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function a(e){return r[bt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,n).then((function(t){return vn(t,e,n)}))}const o=[];for(let r=0,s=e.length;r<s;r++){const s=e[r],u=cn(s),l=i[u];if(l)o.push(l.promise);else{let e;e=s.extensions&&s.extensions[bt.KHR_DRACO_MESH_COMPRESSION]?a(s):vn(new t,s,n),i[u]={primitive:s,promise:e},o.push(e)}}return Promise.all(o)}loadMesh(e){const t=this,n=this.json,r=this.extensions,o=n.meshes[e],s=o.primitives,u=[];for(let e=0,t=s.length;e<t;e++){const t=void 0===s[e].material?(void 0===(l=this.cache).DefaultMaterial&&(l.DefaultMaterial=new I({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ie})),l.DefaultMaterial):this.getDependency("material",s[e].material);u.push(t)}var l;return u.push(t.loadGeometries(s)),Promise.all(u).then((function(n){const u=n.slice(0,n.length-1),l=n[n.length-1],c=[];for(let n=0,h=l.length;n<h;n++){const h=l[n],d=s[n];let f;const p=u[n];if(d.mode===Qt.TRIANGLES||d.mode===Qt.TRIANGLE_STRIP||d.mode===Qt.TRIANGLE_FAN||void 0===d.mode)f=!0===o.isSkinnedMesh?new N(h,p):new U(h,p),!0===f.isSkinnedMesh&&f.normalizeSkinWeights(),d.mode===Qt.TRIANGLE_STRIP?f.geometry=ut(f.geometry,a):d.mode===Qt.TRIANGLE_FAN&&(f.geometry=ut(f.geometry,i));else if(d.mode===Qt.LINES)f=new F(h,p);else if(d.mode===Qt.LINE_STRIP)f=new B(h,p);else if(d.mode===Qt.LINE_LOOP)f=new z(h,p);else{if(d.mode!==Qt.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);f=new G(h,p)}Object.keys(f.geometry.morphAttributes).length>0&&ln(f,o),f.name=t.createUniqueName(o.name||"mesh_"+e),un(f,o),d.extensions&&sn(r,f,d),t.assignFinalMaterial(f),c.push(f)}for(let n=0,r=c.length;n<r;n++)t.associations.set(c[n],{meshes:e,primitives:n});if(1===c.length)return o.extensions&&sn(r,c[0],o),c[0];const h=new V;o.extensions&&sn(r,h,o),t.associations.set(h,{meshes:e});for(let e=0,t=c.length;e<t;e++)h.add(c[e]);return h}))}loadCamera(e){let t;const n=this.json.cameras[e],r=n[n.type];if(r)return"perspective"===n.type?t=new H(j.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(t=new W(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),un(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(e){const n=e.pop(),r=e,i=[],a=[];for(let e=0,o=r.length;e<o;e++){const o=r[e];if(o){i.push(o);const t=new y;null!==n&&t.fromArray(n.array,16*e),a.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new X(i,a)}))}loadAnimation(e){const t=this.json,n=this,r=t.animations[e],i=r.name?r.name:"animation_"+e,a=[],o=[],s=[],u=[],l=[];for(let e=0,t=r.channels.length;e<t;e++){const t=r.channels[e],n=r.samplers[t.sampler],i=t.target,c=i.node,h=void 0!==r.parameters?r.parameters[n.input]:n.input,d=void 0!==r.parameters?r.parameters[n.output]:n.output;void 0!==i.node&&(a.push(this.getDependency("node",c)),o.push(this.getDependency("accessor",h)),s.push(this.getDependency("accessor",d)),u.push(n),l.push(i))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(u),Promise.all(l)]).then((function(e){const t=e[0],r=e[1],a=e[2],o=e[3],s=e[4],u=[];for(let e=0,i=t.length;e<i;e++){const i=t[e],l=r[e],c=a[e],h=o[e],d=s[e];if(void 0===i)continue;i.updateMatrix&&i.updateMatrix();const f=n._createAnimationTracks(i,l,c,h,d);if(f)for(let e=0;e<f.length;e++)u.push(f[e])}return new K(i,void 0,u)}))}createNodeMesh(e){const t=this.json,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(e){const t=n._getNodeRef(n.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]})),t}))}loadNode(e){const t=this,n=this.json.nodes[e],r=t._loadNodeShallow(e),i=[],a=n.children||[];for(let e=0,n=a.length;e<n;e++)i.push(t.getDependency("node",a[e]));const o=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([r,Promise.all(i),o]).then((function(e){const t=e[0],n=e[1],r=e[2];null!==r&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(r,fn)}));for(let e=0,r=n.length;e<r;e++)t.add(n[e]);return t}))}_loadNodeShallow(e){const t=this.json,n=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const i=t.nodes[e],a=i.name?r.createUniqueName(i.name):"",o=[],s=r._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return s&&o.push(s),void 0!==i.camera&&o.push(r.getDependency("camera",i.camera).then((function(e){return r._getNodeRef(r.cameraCache,i.camera,e)}))),r._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){o.push(e)})),this.nodeCache[e]=Promise.all(o).then((function(t){let o;if(o=!0===i.isBone?new Y:t.length>1?new V:1===t.length?t[0]:new b,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),un(o,i),i.extensions&&sn(n,o,i),void 0!==i.matrix){const e=new y;e.fromArray(i.matrix),o.applyMatrix4(e)}else void 0!==i.translation&&o.position.fromArray(i.translation),void 0!==i.rotation&&o.quaternion.fromArray(i.rotation),void 0!==i.scale&&o.scale.fromArray(i.scale);return r.associations.has(o)||r.associations.set(o,{}),r.associations.get(o).nodes=e,o})),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],r=this,i=new V;n.name&&(i.name=r.createUniqueName(n.name)),un(i,n),n.extensions&&sn(t,i,n);const a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(r.getDependency("node",a[e]));return Promise.all(o).then((function(e){for(let t=0,n=e.length;t<n;t++)i.add(e[t]);return r.associations=(e=>{const t=new Map;for(const[e,n]of r.associations)(e instanceof P||e instanceof ae)&&t.set(e,n);return e.traverse((e=>{const n=r.associations.get(e);null!=n&&t.set(e,n)})),t})(i),i}))}_createAnimationTracks(e,t,n,r,i){const a=[],o=e.name?e.name:e.uuid,s=[];let u;switch(tn[i.path]===tn.weights?e.traverse((function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)})):s.push(o),tn[i.path]){case tn.weights:u=se;break;case tn.rotation:u=ue;break;case tn.position:case tn.scale:u=oe;break;default:if(1===n.itemSize)u=se;else u=oe}const l=void 0!==r.interpolation?nn[r.interpolation]:Q,c=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){const n=new u(s[e]+"."+tn[i.path],t.array,c,l);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=dn(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof ue?Yt:Xt)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function vn(e,t,n){const r=t.attributes,i=[];function a(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(const t in r){const n=en[t]||t.toLowerCase();n in e.attributes||i.push(a(r[t],n))}if(void 0!==t.indices&&!e.index){const r=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));i.push(r)}return Z.workingColorSpace!==c&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Z.workingColorSpace}" not supported.`),un(e,t),function(e,t,n){const r=t.attributes,i=new le;if(void 0===r.POSITION)return;{const e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new _(t[0],t[1],t[2]),new _(a[0],a[1],a[2])),e.normalized){const t=dn(Zt[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}const a=t.targets;if(void 0!==a){const e=new _,t=new _;for(let r=0,i=a.length;r<i;r++){const i=a[r];if(void 0!==i.POSITION){const r=n.json.accessors[i.POSITION],a=r.min,o=r.max;if(void 0!==a&&void 0!==o){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),r.normalized){const e=dn(Zt[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(e)}e.boundingBox=i;const o=new ce;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o}(e,t,n),Promise.all(i).then((function(){return void 0!==t.targets?function(e,t,n){let r=!1,i=!1,a=!1;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(void 0!==n.POSITION&&(r=!0),void 0!==n.NORMAL&&(i=!0),void 0!==n.COLOR_0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);const o=[],s=[],u=[];for(let l=0,c=t.length;l<c;l++){const c=t[l];if(r){const t=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;o.push(t)}if(i){const t=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal;s.push(t)}if(a){const t=void 0!==c.COLOR_0?n.getDependency("accessor",c.COLOR_0):e.attributes.color;u.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(u)]).then((function(t){const n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}var mn=function(){function t(e){var n;Oe(this,t);var r=He({zooms:[4,22],interact:!0,models:[],impactName:"灯杆",animate:!0},e);return Ue(n=Ie(this,t,[r]),"_lastPick",null),Ue(n,"_data",[]),Ue(n,"_group",null),Ue(n,"_models",[]),Ue(n,"_impactName",""),Ue(n,"_mixers",[]),n._impactName=r.impactName,r.models.length<=0?(console.error("缺少模型配置"),je(n)):(n._models=Ye(r.models),n.loader=null,r.data&&(n.data=r.data),n)}return ze(t,nt),Ne(t,[{key:"data",get:function(){return this._data},set:function(e){var t=e.features,n=[];t?(this._data=t.map((function(e){var t=e.properties,n=e.geometry;return He(He({},t),{},{lngLat:n.coordinates})})),n=this.customCoords.lngLatsToCoords(t.map((function(e){return e.geometry.coordinates})))):e instanceof Array&&(this._data=e,n=this.customCoords.lngLatsToCoords(e.map((function(e){return e.lngLat})))),this._data.forEach((function(e,t){e.coords=n[t]})),this.updateModel()}},{key:"init",value:function(){}},{key:"onReady",value:function(){this.updateModel(),this.initMouseEvent()}},{key:"onPicked",value:function(e){var t,n,r=e.targets,i=e.event,a=null;if(r.length>0){var o=this.getParentObject(r[0],{name:this._impactName});o?(this.setLastPick(o),a=o._attrs):this.removeLastPick()}else this.removeLastPick();this.handleEvent("pick",{screenX:null==i||null===(t=i.pixel)||void 0===t?void 0:t.x,screenY:null==i||null===(n=i.pixel)||void 0===n?void 0:n.y,attrs:a})}},{key:"loadOneModel",value:function(e,t){var n=this,r=this._models,i=e.modelId,a=e.size,o=e.sourceUrl;return new Promise((function(e){void 0!==(r.find((function(e){return e.modelId===i}))||{}).model?e():n.loader.load(o,(function(n){var i=n.scene.children[0];i.scale.set(a,a,a),i.rotateX(Math.PI/2),r[t].model=i,r[t].animations=n.animations,e()}),(function(e){console.log(e.loaded/e.total*100+"% loaded")}),(function(e){console.log("An error happened"+e)}))}))}},{key:"loadModel",value:(r=Ee(We().mark((function t(){var n,r;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null===this.loader&&(this.loader=new xt),null===this._group&&(this._group=new e.Group,this.scene.add(this._group)),n=this._models,r=0;case 4:if(!(r<n.length)){t.next=10;break}return t.next=7,this.loadOneModel(n[r],r);case 7:r++,t.next=4;break;case 10:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"clearModel",value:function(){if(this._group){var e=this._group.children;do{this._group.remove(e[0])}while(e.length>0);this._mixers.length&&(this._mixers.forEach((function(e){e.stopAllAction(),e.uncacheRoot()})),this._mixers=[])}}},{key:"getModelConfById",value:function(e){return this._models.find((function(t){return t.modelId===e}))}},{key:"initMouseEvent",value:function(){var e=this;this.container.addEventListener("click",(function(t){var n=e._lastPick;n&&e.handleEvent("click",{screenX:null==t?void 0:t.clientX,screenY:null==t?void 0:t.clientY,attrs:n._attrs})}))}},{key:"updateModel",value:(n=Ee(We().mark((function t(){var n,r,i,a,o=this;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.scene){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,this.loadModel();case 4:n=this._group,r=this._data,i=this._isAnimate,a=this._mixers,this.clearModel(),r.forEach((function(t,r){var s=t.id,u=t.modelId,l=t.altitude,c=t.angle,h=t.coords,d=t.lngLat,f=o.getModelConfById(u),p=f.model,v=f.animations,m=f.upAxis,g=p.clone();if(g._attrs={id:s,altitude:l,angle:c,coords:h,modelId:u,lngLat:d},g.position.set(h[0],h[1],void 0===l?0:l),void 0!==c&&g["x"===m?"rotateX":"z"===m?"rotateZ":"rotateY"](-c/180*Math.PI),i&&v.length){var y=new e.AnimationMixer(g),_=y.clipAction(v[0]);_.loop=e.LoopRepeat,_.play(),a.push(y)}n.add(g)}));case 7:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"getModelById",value:function(e){return this._group.children.find((function(t){return t._attrs.id===e}))||null}},{key:"getParentObject",value:function(e,t){var n=e.object,r=t.name;do{var i;if(n.name===r||"Scene"===(null===(i=n.parent)||void 0===i||null===(i=i.parent)||void 0===i?void 0:i.type))return n;n=n.parent}while(n)}},{key:"setLastPick",value:function(t){var n=this._lastPick,r=this.scene;if(t&&(!n||JSON.stringify(null==n?void 0:n._attrs)!==JSON.stringify(null==t?void 0:t._attrs))){this.removeLastPick();var i=new e.BoxHelper(t,"#00ff00");r.add(i),i._attrs=null==t?void 0:t._attrs,this._lastPick=i}}},{key:"removeLastPick",value:function(){var e=this._lastPick,t=this.scene;e&&(t.remove(e),this._lastPick=null)}},{key:"update",value:function(){this._isAnimate&&this._mixers.forEach((function(e){e.update(.02)}))}}]);var n,r}(),gn=function(){function t(e){var n;Oe(this,t);var r=He({zooms:[4,22],interact:!0,models:[],animate:!0},e);return Ue(n=Ie(this,t,[r]),"_lastPickIndex",{index:null,modelId:null}),Ue(n,"_data",{}),Ue(n,"_group",null),Ue(n,"_models",[]),r.models.length<=0?(console.error("缺少模型配置"),je(n)):(n._models=Ye(r.models),n.loader=null,r.data&&(n.data=r.data),n)}return ze(t,nt),Ne(t,[{key:"data",get:function(){return this._data},set:function(e){var t=this,n=e.features,r=[];n?this._data=n.map((function(e){var t=e.properties,n=e.geometry;return He(He({},t),{},{lngLat:n.coordinates})})):e instanceof Array&&e.forEach((function(e){var n=e.modelId;void 0===r[n]&&(r[n]=[]);var i=t.customCoords.lngLatsToCoords([e.lngLat]);r[n].push(He({coords:i[0]},e))})),this._data=r,this.updateModel()}},{key:"init",value:function(){}},{key:"onReady",value:function(){this.updateModel(),this.initMouseEvent()}},{key:"onPicked",value:function(e){var t,n,r=e.targets,i=e.event,a=null;if(r.length>0){var o=r[0].object;if(null!=o&&o.isInstancedMesh){var s=o.attrs.modelId,u=this._raycaster.intersectObject(o,!1)[0].instanceId;this.setLastPick({index:u,modelId:s}),a=this._data[s][u]}}else this.removeLastPick();this.handleEvent("pick",{screenX:null==i||null===(t=i.pixel)||void 0===t?void 0:t.x,screenY:null==i||null===(n=i.pixel)||void 0===n?void 0:n.y,attrs:a})}},{key:"loadOneModel",value:function(e,t){var n=this,r=this._models,i=e.modelId,a=e.sourceUrl;return new Promise((function(e){void 0!==(r.find((function(e){return e.modelId===i}))||{}).model?e():n.loader.load(a,(function(n){var i=n.scene.children[0];r[t].model=i,e()}),(function(e){console.log(e.loaded/e.total*100+"% loaded")}),(function(e){console.log("loader model fail"+e)}))}))}},{key:"loadModel",value:(r=Ee(We().mark((function t(){var n;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null===this.loader&&(this.loader=new xt),null===this._group&&(this._group=new e.Group,this.scene.add(this._group)),n=0;case 3:if(!(n<this._models.length)){t.next=9;break}return t.next=6,this.loadOneModel(this._models[n],n);case 6:n++,t.next=3;break;case 9:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"clearModel",value:function(){if(this._group){var e=this._group.children;do{this._group.remove(e[0])}while(e.length>0)}}},{key:"getModelConfById",value:function(e){return this._models.find((function(t){return t.modelId===e}))}},{key:"initMouseEvent",value:function(){}},{key:"updateModel",value:(n=Ee(We().mark((function e(){var t,n,r,i,a,o;return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.scene){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.loadModel();case 4:for(t=this._group,n=this._data,this.clearModel(),r=Object.keys(n),i=0;i<r.length;i++)a=r[i],o=this.createInstancedMesh(this.getModelConfById(a),n[a]),t.add(o);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createInstancedMesh",value:function(t,n){var r=t.model,i=t.size,a=t.name,o=t.modelId,s=n.length,u=r.geometry,l=r.material,c=new e.InstancedMesh(u,l,s);c.attrs={name:a,modelId:o};var h=new e.Object3D;h.scale.set(i,i,i),h.rotateX(Math.PI/2);for(var d=new e.Color,f=0;f<s;f++){var p=n[f];p.id,p.modelId;var v=p.altitude,m=p.angle,g=p.coords;h.position.set(g[0],g[1],void 0===v?0:v),h.updateMatrix(),void 0!==m&&h.rotateY(-m/180*Math.PI),c.setMatrixAt(f,h.matrix),c.setColorAt(f,d)}return c}},{key:"getModelById",value:function(e){return this._group.children.find((function(t){return t._attrs.id===e}))||null}},{key:"setLastPick",value:function(t){var n=t.index,r=t.modelId;if(this._lastPickIndex.index!==n||this._lastPickIndex.modelId!==r){var i=this.getMeshByModelId(r);i&&(null!==this._lastPickIndex.index&&(i.setColorAt(this._lastPickIndex.index,new e.Color),i.instanceColor.needsUpdate=!0),i.setColorAt(n,new e.Color(65535)),i.instanceColor.needsUpdate=!0,this._lastPickIndex={index:n,modelId:r})}}},{key:"getMeshByModelId",value:function(e){var t;return null===(t=this._group)||void 0===t?void 0:t.children.find((function(t){return t.attrs.modelId===e}))}},{key:"removeLastPick",value:function(){var t=this._lastPickIndex,n=t.index,r=t.modelId;if(null!==n&&null!==r){var i=this.getMeshByModelId(r);if(i){var a=new e.Color;i.setColorAt(n,a),i.instanceColor.needsUpdate=!0,this._lastPickIndex={index:null,modelId:null}}}}},{key:"update",value:function(){}}]);var n,r}(),yn=function(){function t(e){var n;Oe(this,t);var r=He({data:null,speed:1,animate:!0,lineWidth:20,altitude:0,sizeAttenuation:!0,uvMapURL:"./static/texture/road_bg1.png"},e);return Ue(n=Ie(this,t,[r]),"_data",[]),Ue(n,"_material",null),n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"onReady",value:function(){this.initLines()}},{key:"initData",value:function(e){var t=null==e?void 0:e.features.map((function(e){var t;return null==e||null===(t=e.geometry)||void 0===t?void 0:t.coordinates[0]})),n=this.customCoords.lngLatsToCoords(t);this._data=n}},{key:"initLines",value:function(){var t=this,n=this.scene,r=(new e.TextureLoader).load(this.mergeSourceURL(this._conf.uvMapURL));r.wrapS=e.RepeatWrapping,r.wrapT=e.RepeatWrapping;var i=new yt({lineWidth:this._conf.lineWidth,sizeAttenuation:this._conf.sizeAttenuation?1:0,useMap:1,opacity:1,map:r,transparent:!0,depthTest:!0,repeat:new e.Vector2(2,1)});this._material=i,Ye(this._data).forEach((function(r){var a=[];r.forEach((function(n){var r=Ke(n,2),i=r[0],o=r[1];a.push(new e.Vector3(i,o,t._conf.altitude))}));var o=new gt;o.setPoints(a);var s=new e.Mesh(o,i);n.add(s)}))}},{key:"update",value:function(){var e;this._isAnimate&&null!==(e=this._material)&&void 0!==e&&null!==(e=e.uniforms)&&void 0!==e&&e.offset&&(this._material.uniforms.offset.value.x-=.01*this._conf.speed)}}])}(),_n=function(){function t(e){var n;Oe(this,t);var r=He({zooms:[10,22],data:null,icon:{src:"./static/texture/pole.svg",alphaMapURL:"./static/texture/pole.svg",color:"rgba(0,255,255,0.8)",size:[64,128]}},e);return Ue(n=Ie(this,t,[r]),"_data",[]),Ue(n,"_features",[]),Ue(n,"_currIcon",null),n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"onReady",value:function(){this.initMaterial(),this.createMesh()}},{key:"onPicked",value:function(e){var t=e.targets,n=Ke(this._conf.icon.size,2),r=n[0],i=n[1];t.length>0?(t[0].object.scale.set(1.5*r,1.5*i,0),this._currIcon&&this._currIcon.object.scale.set(r,i,0),this._currIcon=t[0]):(this._currIcon&&this._currIcon.object.scale.set(r,i,0),this._currIcon=null)}},{key:"initData",value:function(e){var t=e.features,n=t.map((function(e){var t=Ke(e.geometry.coordinates,2);return[t[0],t[1]]}));this._features=t,this._data=this.customCoords.lngLatsToCoords(n)}},{key:"initMaterial",value:function(){var t=this._conf.icon,n=(new e.TextureLoader).load(t.src),r=new e.SpriteMaterial({map:n,transparent:!0,depthTest:!0});return t.alphaMapURL?r.alphaMap=(new e.TextureLoader).load(t.alphaMapURL):r.alphaMap=n,t.color&&(r.color=new e.Color(t.color)),r.blending=e.CustomBlending,r.blendDst=e.OneFactor,this._material=r,r}},{key:"createMesh",value:function(){for(var t=this.scene,n=Ke(this._conf.icon.size,2),r=n[0],i=n[1],a=0;a<this._data.length;a++){var o=Ke(this._data[a],2),s=o[0],u=o[1],l=new e.Sprite(this._material);l._attrs=this._features[a],l.scale.set(r,i,0),l.position.set(s,u,i/2),t.add(l)}}}])}(),xn="\n    // 每个点的尺寸倍率属性\n    attribute float size; \n    // 每个点的自定义颜色属性\n    attribute vec3 customColor;\n    \n    // 指定点的大小是否因相机深度而衰减\n    uniform bool sizeAttenuation;\n    \n    // 传递颜色到片元着色器的变量\n    varying vec3 vColor; \n   \n    void main() {\n    \n      // 将自定义颜色传递到片元着色器\n      vColor = customColor;\n      \n      // 将顶点位置转换到视图空间\n      vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n      \n      if(sizeAttenuation){\n        // 根据到相机的距离计算点的大小\n        gl_PointSize = size * (512.0 / -mvPosition.z );     \n      }else{\n        gl_PointSize = size ;   \n      }\n      \n      // 计算点在投影空间的最终位置\n      gl_Position = projectionMatrix * mvPosition; \n    }\n  ",wn="\n    // 点的基础颜色统一变量\n    uniform vec3 color;  // 基础颜色\n    // 点贴图统一变量\n    uniform sampler2D pointTexture; //点贴图\n    // 透明度测试阈值统一变量\n    uniform float alphaTest; //透明度阈值\n    \n    // 获取每个点自定义颜色的变量\n    varying vec3 vColor; // 每个点的颜色\n    \n    void main() {\n    \n      // 计算点的最终颜色,乘以基础颜色和自定义颜色\n      gl_FragColor = vec4( color * vColor, 1.0 );\n      \n      // 将点贴图应用到点上     \n      // gl_FragColor = gl_FragColor * texture2D(pointTexture, gl_PointCoord);\n      \n      // 将点贴图应用到点上,gl_PointCoord的值是从[0, 1]映射到[1, 0]的范围,需要把贴图y分量翻转\n      gl_FragColor = gl_FragColor * texture2D(pointTexture, vec2(gl_PointCoord.x, 1.0 - gl_PointCoord.y));\n      \n      // 如果alpha值小于透明度测试阈值,则丢弃片元\n      if ( gl_FragColor.a < alphaTest ) discard;\n      \n    }\n      ",bn=function(){function t(e){var n;Oe(this,t);var r=He({zooms:[10,22],data:null,intensity:0,icon:{src:"./static/texture/pole.svg",alphaMapURL:"./static/texture/pole.svg",color:"rgba(0,255,255,0.8)",size:[64,64]},pickThreshold:0,sizeAttenuation:!0,interact:!0},e);return Ue(n=Ie(this,t,[r]),"_data",[]),Ue(n,"_features",[]),Ue(n,"_currIcon",null),n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"onReady",value:(i=Ee(We().mark((function e(){var t,n,r;return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.createMesh();case 2:this._raycaster&&(t=this._conf,n=t.pickThreshold,r=t.icon,this._raycaster.params.Points.threshold=n>0?n:r.size[0]/4||1);case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"onPicked",value:function(e){var t=e.targets,n=this._mesh.geometry.attributes,r=this._conf.icon.size[0];t.length>0?this._currIcon!==t[0].index&&(n.size.array[this._currIcon]=r,this._currIcon=t[0].index,n.size.array[this._currIcon]*=1.2,n.size.needsUpdate=!0):null!==this._currIcon&&(n.size.array[this._currIcon]=r,n.size.needsUpdate=!0,this._currIcon=null)}},{key:"initData",value:function(e){var t=e.features,n=t.map((function(e){var t=Ke(e.geometry.coordinates,2);return[t[0],t[1]]}));this._data=this.customCoords.lngLatsToCoords(n),this._features=t}},{key:"generateMaterial",value:(r=Ee(We().mark((function t(){var n,r,i,a,o,s,u;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._conf,r=n.icon,i=n.sizeAttenuation,t.next=3,(new e.TextureLoader).load(r.src);case 3:return a=t.sent,o=xn,s=wn,u=new e.ShaderMaterial({uniforms:{color:{value:new e.Color(r.color||16777215)},pointTexture:{value:a},alphaTest:{value:.1},sizeAttenuation:{value:i}},vertexShader:o,fragmentShader:s,transparent:!0}),t.abrupt("return",u);case 7:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"generateGeometry",value:function(){for(var t=new e.BufferGeometry,n=[],r=[],i=[],a=this._conf.icon.size[0],o=new e.Color,s=0;s<this._data.length;s++){var u=Ke(this._data[s],2),l=u[0],c=u[1],h=this._features[s].properties.scale||1;r.push(a*h),n.push(l,c,a*h/5.12),o.set(this._features[s].properties.color||"#ffffff"),o.toArray(i,3*s)}return t.setAttribute("position",new e.Float32BufferAttribute(n,3)),t.setAttribute("customColor",new e.Float32BufferAttribute(i,3)),t.setAttribute("size",new e.Float32BufferAttribute(r,1)),t}},{key:"createMesh",value:(n=Ee(We().mark((function t(){var n,r,i;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.generateGeometry(),t.next=3,this.generateMaterial();case 3:r=t.sent,i=new e.Points(n,r),this.scene.add(i),this._mesh=i;case 7:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"updateUniforms",value:function(e,t){this._mesh.material.uniforms[e].value=t}}]);var n,r,i}(),An="\n    //初始透明度\n    // attribute float opacity;\n    //点尺寸\n    uniform float size;\n    \n    void main()\n    {  \n      // float m = mod( opacity + time , 2.0);\n      // uvOpacity = m >= 1.5 ? (2.0-m) : m ;    \n      gl_PointSize = size;\n      gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n    }\n  ",Mn="\n    #define MOD3 vec3(.1031,.11369,.13787)\n    \n    uniform vec3 color;\n    uniform float time;\n    // varying float uvOpacity;   \n    \n    float hash12(vec2 p) \n    {\n      vec3 p3  = fract(vec3(p.xyx) * MOD3);\n      p3 += dot(p3, p3.yzx + 19.19);\n      return fract((p3.x + p3.y) * p3.z);\n    }\n   \n    float stars(vec2 uv, float t)\n    {     \n      //调整闪烁频率\n      t*= 1.0;     \n      // 调整噪点透明度\n      // float n1 = hash12(uv*10000.);\n      // float n2 = hash12(uv*11234.);\n      // float alpha1 = pow(n1, 20.);\n      // float alpha2 = pow(n2, 20.);\n\n      //随机性闪烁\n      float twinkle = sin((uv.x-t+cos(uv.y*20.+t))*10.);\n      twinkle *= cos((uv.y*.234-t*3.24+sin(uv.x*12.3+t*.243))*7.34);\n      twinkle = (twinkle + 1.)/2.;\n      return twinkle;\n    }\n   \n    void main() \n    {\n      //坐标原点为画布的左上角，x轴水平向右，y竖直向下\n      vec2 uv = vec2(gl_FragCoord.x, gl_FragCoord.y);\n      float uvOpacity = stars(uv, time);\n      gl_FragColor = vec4(color, uvOpacity);\n    }\n  ",Tn=function(){function t(n){var r;Oe(this,t);var i=He({data:null,animate:!0},n);return Ue(r=Ie(this,t,[i]),"_data",[]),Ue(r,"uniforms",{color:{type:"v3",value:new e.Color(16701210)},size:{type:"float",value:1},time:{type:"float",value:0}}),r.initData(i.data),r}return ze(t,nt),Ne(t,[{key:"onReady",value:function(){this.initPoints()}},{key:"initData",value:function(e){var t=e.features.map((function(e){var t=Ke(e.geometry.coordinates,2);return[t[0],t[1]]}));this._data=this.customCoords.lngLatsToCoords(t)}},{key:"initPoints",value:function(){var t=this.scene,n=[],r=[];this._data.forEach((function(e){var t=Ke(e,2),i=t[0],a=t[1];n.push(i,a,0),r.push(parseFloat(Math.random().toFixed(2)))}));var i=new e.BufferGeometry;i.setAttribute("position",new e.Float32BufferAttribute(n,3)),i.setAttribute("opacity",new e.Float32BufferAttribute(r,1));var a=An,o=Mn,s=new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:a,fragmentShader:o,blending:e.AdditiveBlending,depthTest:!1,transparent:!0}),u=new e.Points(i,s);t.add(u)}},{key:"update",value:function(){this._isAnimate&&(this.uniforms.time.value+=.01)}}])}(),kn=function(){function t(e){var n;Oe(this,t);var r=He({data:null,speed:1,radius:1e3,animate:!0,textureURL:"./static/texture/texture_wave_circle.png"},e);return Ue(n=Ie(this,t,[r]),"_data",[]),Ue(n,"_frameX",1),Ue(n,"_texture",null),Ue(n,"_offset",0),n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"onReady",value:(r=Ee(We().mark((function e(){return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.initPoints();case 2:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"initData",value:function(e){var t=e.features.map((function(e){return He({lngLat:e.geometry.coordinates},e.properties)})),n=this.customCoords.lngLatsToCoords(t.map((function(e){return e.lngLat})));this._data=n}},{key:"initPoints",value:(n=Ee(We().mark((function t(){var n,r,i,a,o,s,u=this;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.scene,r=new e.TextureLoader,t.next=4,r.loadAsync(this.mergeSourceURL(this._conf.textureURL));case 4:i=t.sent,a=i.image,o=a.width,s=a.height,this._frameX=o/s,i.wrapS=i.wrapT=e.RepeatWrapping,i.repeat.set(1/this._frameX,1),this._texture=i,this._data.forEach((function(t){var r=Ke(t,2),a=r[0],o=r[1],s=u.generateGeometry(a,o),l=new e.MeshBasicMaterial({map:i,transparent:!0,depthTest:!0,depthWrite:!1}),c=new e.Mesh(s,l);n.add(c)}));case 11:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"generateGeometry",value:function(t,n){var r=this._conf.radius,i=[new e.Vector3(t-r,n-r,0),new e.Vector3(t+r,n-r,0),new e.Vector3(t-r,n+r,0),new e.Vector3(t-r,n+r,0),new e.Vector3(t+r,n-r,0),new e.Vector3(t+r,n+r,0)],a=(new e.BufferGeometry).setFromPoints(i);return a.setAttribute("uv",new e.BufferAttribute(new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),2)),a}},{key:"update",value:function(){this._isAnimate&&this._texture&&(this._offset+=this._conf.speed,this._texture.offset.x=Math.floor(this._offset)/this._frameX)}}]);var n,r}(),Sn=function(){function t(e){var n;Oe(this,t);var r=He({data:null,scale:1,altitude:100,content:null,sizeAttenuation:!0,interact:!1,pickEvent:"click"},e);return Ue(n=Ie(this,t,[r]),"_data",[]),Ue(n,"_feature",[]),Ue(n,"_size",1),Ue(n,"_content",null),n._content=r.content,n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"onReady",value:(i=Ee(We().mark((function e(){return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.initSprites();case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"initData",value:function(e){var t=[],n=[];e.features.forEach((function(e){var r=e.properties,i=e.geometry,a=i.coordinates;t.push(a),n.push(He({type:i.type,coordinates:a},r))}));var r=this.customCoords.lngLatsToCoords(t);this._data=r,this._feature=n}},{key:"setSource",value:function(e){}},{key:"setContent",value:function(e){}},{key:"generateMaterial",value:(r=Ee(We().mark((function t(n,r){var i,a,o,s,u,l,c,h;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._content){t.next=3;break}return console.error("SpriteLayer 参数content 不能为空"),t.abrupt("return");case 3:return"function"===(a=it(this._content))?i=this._content(n,r):"string"===a&&(i=this._content),o=(new DOMParser).parseFromString(i,"text/xml").childNodes[0],(s=document.createElement("div")).style.cssText=o.getAttribute("style"),s.innerHTML=o.innerHTML,document.body.append(s),u=s.offsetWidth/s.offsetHeight,t.next=13,Ce(s,{backgroundColor:null,dpi:window.devicePixelRatio});case 13:return l=t.sent,(c=new e.Texture(l)).needsUpdate=!0,document.body.removeChild(s),h=new e.SpriteMaterial({map:c,sizeAttenuation:this._conf.sizeAttenuation,transparent:!0}),t.abrupt("return",{material:h,ratio:u});case 19:case"end":return t.stop()}}),t,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"initSprites",value:(n=Ee(We().mark((function t(){var n,r,i,a,o,s,u,l,c,h;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=this.scene,r=this._size*this._conf.scale,i=0;case 3:if(!(i<this._data.length)){t.next=18;break}return a=Ke(this._data[i],2),o=a[0],s=a[1],t.next=7,this.generateMaterial(i,this._feature[i]);case 7:u=t.sent,l=u.material,c=u.ratio,(h=new e.Sprite(l))._attrs=this._feature[i],h.scale.set(c*r,1*r,0),h.position.set(o,s,this._conf.altitude),n.add(h);case 15:i++,t.next=3;break;case 18:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"onPicked",value:function(e){var t,n,r=e.targets,i=e.event,a=null;if(r.length>0){var o=this.getParentObject(r[0]);o&&(a=o._attrs)}this.handleEvent("pick",{screenX:null==i||null===(t=i.pixel)||void 0===t?void 0:t.x,screenY:null==i||null===(n=i.pixel)||void 0===n?void 0:n.y,attrs:a})}},{key:"getParentObject",value:function(e){var t=e.object;do{var n;if(["Scene","Group"].includes(null===(n=t.parent)||void 0===n?void 0:n.type))return t;t=t.parent}while(t)}},{key:"update",value:function(){}}]);var n,r,i}();const Cn=new WeakMap;class Rn extends o{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,r){const i=new u(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(e=>{this.parse(e,t,r)}),n,r)}parse(e,t,n){this.decodeDracoFile(e,t,null,null,v).catch(n)}decodeDracoFile(e,t,n,r,i=c){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:i};return this.decodeGeometry(e,a).then(t)}decodeGeometry(e,t){const n=JSON.stringify(t);if(Cn.has(e)){const t=Cn.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const i=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(i,a).then((n=>(r=n,new Promise(((n,a)=>{r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return o.catch((()=>!0)).then((()=>{r&&i&&this._releaseTask(r,i)})),Cn.set(e,{key:n,promise:o}),o}_createGeometry(e){const r=new t;e.index&&r.setIndex(new n(e.index.array,1));for(let t=0;t<e.attributes.length;t++){const i=e.attributes[t],a=i.name,o=i.array,s=i.itemSize,u=new n(o,s);"color"===a&&(this._assignVertexColorSpace(u,i.vertexColorSpace),u.normalized=o instanceof Float32Array==!1),r.setAttribute(a,u)}return r}_assignVertexColorSpace(e,t){if(t!==v)return;const n=new l;for(let t=0,r=e.count;t<r;t++)n.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new u(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise(((t,r)=>{n.load(e,t,void 0,r)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const r=Ln.toString(),i=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const n=t.data;switch(n.type){case"decode":e._callbacks[n.id].resolve(n);break;case"error":e._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function Ln(){let e,t;function n(e,t,n,r,i,a){const o=a.num_components(),s=n.num_points()*o,u=s*i.BYTES_PER_ELEMENT,l=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),c=e._malloc(u);t.GetAttributeDataArrayForAllPoints(n,a,l,u,c);const h=new i(e.HEAPF32.buffer,c,s).slice();return e._free(c),{name:r,array:h,itemSize:o}}onmessage=function(r){const i=r.data;switch(i.type){case"init":e=i.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const r=i.buffer,a=i.taskConfig;t.then((e=>{const t=e.draco,o=new t.Decoder;try{const e=function(e,t,r,i){const a=i.attributeIDs,o=i.attributeTypes;let s,u;const l=t.GetEncodedGeometryType(r);if(l===e.TRIANGULAR_MESH)s=new e.Mesh,u=t.DecodeArrayToMesh(r,r.byteLength,s);else{if(l!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");s=new e.PointCloud,u=t.DecodeArrayToPointCloud(r,r.byteLength,s)}if(!u.ok()||0===s.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+u.error_msg());const c={index:null,attributes:[]};for(const r in a){const u=self[o[r]];let l,h;if(i.useUniqueIDs)h=a[r],l=t.GetAttributeByUniqueId(s,h);else{if(h=t.GetAttributeId(s,e[a[r]]),-1===h)continue;l=t.GetAttribute(s,h)}const d=n(e,t,s,r,u,l);"color"===r&&(d.vertexColorSpace=i.vertexColorSpace),c.attributes.push(d)}l===e.TRIANGULAR_MESH&&(c.index=function(e,t,n){const r=n.num_faces(),i=3*r,a=4*i,o=e._malloc(a);t.GetTrianglesUInt32Array(n,a,o);const s=new Uint32Array(e.HEAPF32.buffer,o,i).slice();return e._free(o),{array:s,itemSize:1}}(e,t,s));return e.destroy(s),c}(t,o,new Int8Array(r),a),s=e.attributes.map((e=>e.array.buffer));e.index&&s.push(e.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:e},s)}catch(e){console.error(e),self.postMessage({type:"error",id:i.id,error:e.message})}finally{t.destroy(o)}}))}}}var Pn,En=function(){function t(e){var n;return Oe(this,t),Ue(n=Ie(this,t,[He({zooms:[5,22],tilesURL:"",center:null,loaderURL:"./static/three/examples/js/libs/gltf/",altitude:0},e)]),"_tilesRendererArr",[]),n}return ze(t,nt),Ne(t,[{key:"onReady",value:function(){this.loadTiles()}},{key:"getCenter",value:function(){return this.customCoords.getCenter()}},{key:"loadTiles",value:function(){var e=new Rn;e.setDecoderPath(this.mergeSourceURL(this._conf.loaderURL));var t=new xt;t.setDRACOLoader(e);var n=new Re(this._conf.tilesURL);n.manager.addHandler(/\.gltf$/,t),n.setCamera(this.camera),n.setResolutionFromRenderer(this.camera,this.renderer),n.group.position.z=this._conf.altitude,this.scene.add(n.group),this._tilesRendererArr.push(n),this._conf.needShadow&&(n.onLoadModel=function(){n.group.traverse((function(e){e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0)}))})}},{key:"update",value:function(){var e,t=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=qe(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(this._tilesRendererArr);try{for(t.s();!(e=t.n()).done;){e.value.update()}}catch(e){t.e(e)}finally{t.f()}}},{key:"onPicked",value:function(e){var t=e.targets;e.event,t.length>0?(this.removeLastPick(),this.setLastPick(t[0].object)):this.removeLastPick()}},{key:"setLastPick",value:function(t){var n=this._lastPick;t&&"Mesh"===t.type&&(n&&JSON.stringify(null==n?void 0:n.uuid)===JSON.stringify(null==t?void 0:t.uuid)||(this.removeLastPick(),t.material.color=new e.Color(246/255,215/255,17/255),this._lastPick=t))}},{key:"removeLastPick",value:function(){this._lastPick&&(this._lastPick.material.color=new e.Color(1,1,1))}},{key:"getParentObject",value:function(e,t){var n=e.object,r=t.name;do{if(n.name===r)return n;n=n.parent}while(n)}}])}(),In={uniforms:{normalSampler:{type:"t",value:null},mirrorSampler:{type:"t",value:null},alpha:{type:"f",value:1},time:{type:"f",value:0},distortionScale:{type:"f",value:20},noiseScale:{type:"f",value:1},textureMatrix:{type:"m4",value:new e.Matrix4},sunColor:{type:"c",value:new e.Color(8355711)},sunDirection:{type:"v3",value:new e.Vector3(.70707,.70707,0)},eye:{type:"v3",value:new e.Vector3(0,0,0)},waterColor:{type:"c",value:new e.Color(5592405)}},vertexShader:"\n    uniform mat4 textureMatrix;\n    uniform float time;\n    varying vec4 mirrorCoord;\n    varying vec3 worldPosition;\n    varying vec3 modelPosition;\n    varying vec3 surfaceX;\n    varying vec3 surfaceY;\n    varying vec3 surfaceZ;\n    void main()\n    {\n      mirrorCoord = modelMatrix * vec4(position, 1.0);\n      worldPosition = mirrorCoord.xyz;\n      modelPosition = position;\n      surfaceX = vec3( modelMatrix[0][0], modelMatrix[0][1], modelMatrix[0][2]);\n      surfaceY = vec3( modelMatrix[1][0], modelMatrix[1][1], modelMatrix[1][2]);\n      surfaceZ = vec3( modelMatrix[2][0], modelMatrix[2][1], modelMatrix[2][2]);\n      mirrorCoord = textureMatrix * mirrorCoord;\n      gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n    }\n  ",fragmentShader:["uniform sampler2D mirrorSampler;","uniform float alpha;","uniform float time;","uniform float distortionScale;","uniform float noiseScale;","uniform sampler2D normalSampler;","uniform vec3 sunColor;","uniform vec3 sunDirection;","uniform vec3 eye;","uniform vec3 waterColor;","varying vec4 mirrorCoord;","varying vec3 worldPosition;","varying vec3 modelPosition;","varying vec3 surfaceX;","varying vec3 surfaceY;","varying vec3 surfaceZ;","void sunLight(const vec3 surfaceNormal, const vec3 eyeDirection, in float shiny, in float spec, in float diffuse, inout vec3 diffuseColor, inout vec3 specularColor)","{","\tvec3 reflection = normalize(reflect(-sunDirection, surfaceNormal));","\tfloat direction = max(0.0, dot(eyeDirection, reflection));","\tspecularColor += pow(direction, shiny) * sunColor * spec;","\tdiffuseColor += max(dot(sunDirection, surfaceNormal), 0.0) * sunColor * diffuse;","}","vec3 getNoise(in vec2 uv)","{","\tvec2 uv0 = uv / (103.0 * noiseScale) + vec2(time / 17.0, time / 29.0);","\tvec2 uv1 = uv / (107.0 * noiseScale) - vec2(time / -19.0, time / 31.0);","\tvec2 uv2 = uv / (vec2(8907.0, 9803.0) * noiseScale) + vec2(time / 101.0, time /   97.0);","\tvec2 uv3 = uv / (vec2(1091.0, 1027.0) * noiseScale) - vec2(time / 109.0, time / -113.0);","\tvec4 noise = texture2D(normalSampler, uv0) +","\t\ttexture2D(normalSampler, uv1) +","\t\ttexture2D(normalSampler, uv2) +","\t\ttexture2D(normalSampler, uv3);","\treturn noise.xyz * 0.5 - 1.0;","}",e.ShaderChunk.common,e.ShaderChunk.fog_pars_fragment,"void main()","{","\tvec3 worldToEye = eye - worldPosition;","\tvec3 eyeDirection = normalize(worldToEye);","\tvec3 noise = getNoise(modelPosition.xy * 1.0);","\tvec3 distordCoord = noise.x * surfaceX + noise.y * surfaceY;","\tvec3 distordNormal = distordCoord + surfaceZ;","\tif(dot(eyeDirection, surfaceZ) < 0.0)","\t\tdistordNormal = distordNormal * -1.0;","\tvec3 diffuseLight = vec3(0.0);","\tvec3 specularLight = vec3(0.0);","\tsunLight(distordNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight);","\tfloat distance = length(worldToEye);","\tvec2 distortion = distordCoord.xy * distortionScale * sqrt(distance) * 0.07;"," vec3 mirrorDistord = mirrorCoord.xyz + vec3(distortion.x, distortion.y, 1.0);"," vec3 reflectionSample = texture2DProj(mirrorSampler, mirrorDistord).xyz;","\tfloat theta = max(dot(eyeDirection, distordNormal), 0.0);","\tfloat reflectance = 0.3 + (1.0 - 0.3) * pow((1.0 - theta), 3.0);","\tvec3 scatter = max(0.0, dot(distordNormal, eyeDirection)) * waterColor;","\tvec3 albedo = mix(sunColor * diffuseLight * 0.3 + scatter, (vec3(0.1) + reflectionSample * 0.9 + reflectionSample * specularLight), reflectance);"," vec3 outgoingLight = albedo;",e.ShaderChunk.fog_fragment," gl_FragColor = vec4( outgoingLight, alpha );","}"].join("\n")},On=function(){function t(n){var r;Oe(this,t);var i=He({data:null,waterColor:"#78acd2",opacity:1,distortionScale:13.7,textureURL:"./static/texture/water_normals.jpg",altitude:0,animate:!0},n);Ue(r=Ie(this,t,[i]),"_data",[]),Ue(r,"uniforms",e.UniformsUtils.merge([e.UniformsLib.fog,e.UniformsLib.lights,In.uniforms]));var a=(new e.TextureLoader).load(r.mergeSourceURL(i.textureURL));return a.wrapS=e.RepeatWrapping,a.wrapT=e.RepeatWrapping,r.uniforms.normalSampler.value=a,r.uniforms.waterColor.value=new e.Color(i.waterColor),r.uniforms.distortionScale.value=i.distortionScale,r.uniforms.alpha.value=i.opacity,r.initData(i.data),r}return ze(t,nt),Ne(t,[{key:"onReady",value:function(){this.createMesh()}},{key:"initData",value:function(e){var t=this;e.features.forEach((function(e){var n=e.geometry,r=e.properties;switch(n.type){case"MultiPolygon":n.coordinates[0].forEach((function(e){t._data.push({path:t.customCoords.lngLatsToCoords(e),properties:r})}));break;case"Polygon":t._data.push({path:t.customCoords.lngLatsToCoords(n.coordinates[0]),properties:r})}})),console.log(this._data)}},{key:"createMesh",value:function(){var e=this;this._data.forEach((function(t){e.drawOneArea(t)}))}},{key:"drawOneArea",value:function(t){var n=t.path,r=this.scene,i=new e.Shape;n.forEach((function(e,t){var n=Ke(e,2),r=n[0],a=n[1];0===t?i.moveTo(r,a):i.lineTo(r,a)}));var a=new e.ShapeGeometry(i),o=new e.Mesh(a,this.getMaterial());o.position.z=this._conf.altitude,r.add(o)}},{key:"getMaterial",value:function(){var t=In.vertexShader,n=In.fragmentShader;return new e.ShaderMaterial({uniforms:this.uniforms,vertexShader:t,fragmentShader:n,depthTest:!0,transparent:!0})}},{key:"update",value:function(){this._isAnimate&&this.uniforms&&(this.uniforms.time.value+=.01,this.uniforms.eye.value.setFromMatrixPosition(this.camera.matrixWorld))}}])}(),Dn="\n       // 可配置变量：高度图纹理\n        uniform sampler2D bumpTexture;\n        // 可配置变量：形变程度，数值越大形变越明显\n        uniform float bumpScale;\n        \n        // 用于传递顶点的高度\n        varying float vAmount;\n        // 用于传递顶点的 UV 贴图坐标\n        varying vec2 vUV;\n        \n        void main()\n        {\n            // 将UV映射传递到片元着色器\n            vUV = uv;\n        \n            // 高度图纹理坐标\n            vec4 bumpData = texture2D(bumpTexture, uv);\n        \n            // 高程图是灰色的(每个点的r=b=g),用于获取顶点高度，因此取rgb中任意一个值即可，这里取r\n            vAmount = bumpData.r;\n        \n            // 将顶点朝着法线的方向移动，平面的法线向上，相当于垂直抬高\n            vec3 newPosition = position + normal * bumpScale * vAmount;\n        \n            // 使用标准公式计算顶点的位置\n            gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);\n        }\n  ",Nn="   \n        // 可配置变量：地形纹理图\n        uniform sampler2D terrainTexture;\n        // 获取从顶点着色器传来的UV\n        varying vec2 vUV;\n        // 获取从顶点着色器传来的 顶点高度\n        varying float vAmount;\n        \n        void main()\n        {\n            // 由UV来确定纹理图布局\n            gl_FragColor = texture2D(terrainTexture, vUV);\n        }\n\n  ",Un=function(){function t(e){var n;return Oe(this,t),Ue(n=Ie(this,t,[He({animate:!1,zooms:[5,14],center:[0,0],style:{width:100,height:100,widthSegments:50,heightSegments:50},intensity:0,unitHeight:2,altitude:0,mapTexture:"./static/texture/terrain_terrain_texture.jpg",normalTexture:"./static/texture/terrain_map_normal.jpg",terrainTexture:"./static/texture/terrain_terrain_texture.jpg"},e)]),"_model",null),n.initData(),n}return ze(t,nt),Ne(t,[{key:"initData",value:function(){var e=Ke(this._conf.center,2),t=e[0],n=e[1];this._data=this.customCoords.lngLatsToCoords([t,n])}},{key:"onReady",value:(n=Ee(We().mark((function e(){return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.createModel();case 1:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createModel",value:function(){var t=this.createPlaneGeometry(),n=(new e.TextureLoader).load(this.mergeSourceURL(this._conf.terrainTexture)),r=(new e.TextureLoader).load(this.mergeSourceURL(this._conf.mapTexture)),i=this.generateMaterial(n,r),a=new e.Mesh(t,i);this.scene.add(a);var o=Ke(this._data[0],2),s=o[0],u=o[1];a.position.set(s,u,this._conf.altitude),this._model=a}},{key:"generateMaterial",value:function(t,n){var r=Dn,i=Nn;return new e.ShaderMaterial({vertexShader:r,fragmentShader:i,uniforms:{terrainTexture:{value:n},bumpTexture:{value:t},bumpScale:{value:100*this._conf.unitHeight}}})}},{key:"setMapTexture",value:function(t){var n;if("string"==typeof t)n=(new e.TextureLoader).load(t);else{if(!(t instanceof e.Texture))throw"setMapTexture value invalid";n=t}var r=(new e.TextureLoader).load(this.mergeSourceURL(this._conf.terrainTexture)),i=this.generateMaterial(r,n);this._model.material=i}},{key:"createPlaneGeometry",value:function(){var t=this._conf.style,n=t.width,r=t.height,i=t.widthSegments,a=t.heightSegments;return new e.PlaneGeometry(n,r,i,a)}},{key:"update",value:function(){}}]);var n}(),Fn=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return this.None(e)},Out:function(e){return this.None(e)},InOut:function(e){return this.None(e)}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(e){var t=1.70158;return 1===e?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return 0===e?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Fn.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*Fn.Bounce.In(2*e):.5*Fn.Bounce.Out(2*e-1)+.5}}),generatePow:function(e){return void 0===e&&(e=4),e=(e=e<Number.EPSILON?Number.EPSILON:e)>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(2*t,e)/2:(1-Math.pow(2-2*t,e))/2+.5}}}}),Bn=function(){return performance.now()},zn=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=Bn()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var i=this._tweens[n[r]],a=!t;i&&!1===i.update(e,a)&&!t&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),Gn={Linear:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),a=Gn.Utils.Linear;return t<0?a(e[0],e[1],r):t>1?a(e[n],e[n-1],n-r):a(e[i],e[i+1>n?n:i+1],r-i)},Bezier:function(e,t){for(var n=0,r=e.length-1,i=Math.pow,a=Gn.Utils.Bernstein,o=0;o<=r;o++)n+=i(1-t,r-o)*i(t,o)*e[o]*a(r,o);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),a=Gn.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(i=Math.floor(r=n*(1+t))),a(e[(i-1+n)%n],e[i],e[(i+1)%n],e[(i+2)%n],r-i)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(a(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):a(e[i?i-1:0],e[i],e[n<i+1?n:i+1],e[n<i+2?n:i+2],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=Gn.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(Pn=[1],function(e){var t=1;if(Pn[e])return Pn[e];for(var n=e;n>1;n--)t*=n;return Pn[e]=t,t}),CatmullRom:function(e,t,n,r,i){var a=.5*(n-e),o=.5*(r-t),s=i*i;return(2*t-2*n+a+o)*(i*s)+(-3*t+3*n-2*a-o)*s+a*i+t}}},Vn=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Hn=new zn,jn=function(){function e(e,t){void 0===t&&(t=Hn),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Fn.Linear.None,this._interpolationFunction=Gn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Vn.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){if(void 0===t&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t,this},e.prototype.duration=function(e){return void 0===e&&(e=1e3),this._duration=e,this},e.prototype.dynamic=function(e){return void 0===e&&(e=!1),this._isDynamic=e,this},e.prototype.start=function(e,t){if(void 0===e&&(e=Bn()),void 0===t&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var n in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var i in this._valuesEnd)r[i]=this._valuesEnd[i];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},e.prototype._setupProperties=function(e,t,n,r,i){for(var a in n){var o=e[a],s=Array.isArray(o),u=s?"array":typeof o,l=!s&&Array.isArray(n[a]);if("undefined"!==u&&"function"!==u){if(l){if(0===(m=n[a]).length)continue;for(var c=[o],h=0,d=m.length;h<d;h+=1){var f=this._handleRelativeValue(o,m[h]);if(isNaN(f)){l=!1,console.warn("Found invalid interpolation list. Skipping.");break}c.push(f)}l&&(n[a]=c)}if("object"!==u&&!s||!o||l)(void 0===t[a]||i)&&(t[a]=o),s||(t[a]*=1),r[a]=l?n[a].slice().reverse():t[a]||0;else{t[a]=s?[]:{};var p=o;for(var v in p)t[a][v]=p[v];r[a]=s?[]:{};var m=n[a];if(!this._isDynamic){var g={};for(var v in m)g[v]=m[v];n[a]=m=g}this._setupProperties(p,t[a],m,r[a],i)}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=Bn()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=Bn()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return void 0===e&&(e=Hn),this._group=e,this},e.prototype.delay=function(e){return void 0===e&&(e=0),this._delayTime=e,this},e.prototype.repeat=function(e){return void 0===e&&(e=0),this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return void 0===e&&(e=!1),this._yoyo=e,this},e.prototype.easing=function(e){return void 0===e&&(e=Fn.Linear.None),this._easingFunction=e,this},e.prototype.interpolation=function(e){return void 0===e&&(e=Gn.Linear),this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=Bn()),void 0===t&&(t=!0),this._isPaused)return!0;var n,r,i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),!1===this._onEveryStartCallbackFired&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),r=(e-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,s=this._chainedTweens.length;o<s;o++)this._chainedTweens[o].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,r){for(var i in n)if(void 0!==t[i]){var a=t[i]||0,o=n[i],s=Array.isArray(e[i]),u=Array.isArray(o);!s&&u?e[i]=this._interpolationFunction(o,r):"object"==typeof o&&o?this._updateProperties(e[i],a,o,r):"number"==typeof(o=this._handleRelativeValue(a,o))&&(e[i]=a+(o-a)*r)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),Wn="20.0.3",Xn=Vn.nextId,Kn=Hn,Yn=Kn.getAll.bind(Kn),Qn=Kn.removeAll.bind(Kn),Zn=Kn.add.bind(Kn),qn=Kn.remove.bind(Kn),Jn=Kn.update.bind(Kn),$n={Easing:Fn,Group:zn,Interpolation:Gn,now:Bn,Sequence:Vn,nextId:Xn,Tween:jn,VERSION:Wn,getAll:Yn,removeAll:Qn,add:Zn,remove:qn,update:Jn},er=Object.freeze({__proto__:null,Easing:Fn,Group:zn,Interpolation:Gn,Sequence:Vn,Tween:jn,VERSION:Wn,add:Zn,default:$n,getAll:Yn,nextId:Xn,now:Bn,remove:qn,removeAll:Qn,update:Jn}),tr=function(){function t(e){var n,r;Oe(this,t);var i=He({path:null,NPC:null,speed:50,cameraFollow:!1,perspective:3},e);return Ue(r=Ie(this,t,[i]),"_data",[]),Ue(r,"_PATH_COORDS",[]),Ue(r,"_PATH_LNG_LAT",[]),Ue(r,"_NPC_ALTITUDE",0),Ue(r,"_rayController",null),Ue(r,"npc_step",0),Ue(r,"_isMoving",!1),r._NPC_ALTITUDE=null!==(n=e.altitude)&&void 0!==n?n:0,r.initData(i.path),r}return ze(t,nt),Ne(t,[{key:"perspective",get:function(){return this._conf.perspective},set:function(e){this._conf.perspective=e,this.updateNPC()}},{key:"onReady",value:function(){this._conf.NPC&&this.initNPC(),this.initController()}},{key:"initData",value:function(e){var t=this,n=e.features;this._data=JSON.parse(JSON.stringify(n)),this._data.forEach((function(e,n){var r=e.geometry,i=r.type,a=r.coordinates;"MultiLineString"===i&&(e.geometry.coordinates=a.map((function(e){return t.handleOnePath(e)}))),"LineString"===i&&(e.geometry.coordinates=t.handleOnePath(a))}))}},{key:"handleOnePath",value:function(t){var n=this,r=this._PATH_LNG_LAT,i=this._PATH_COORDS,a=this._NPC_ALTITUDE,o=i.length,s=t.map((function(e){return[e[0],e[1],e[2]||n._NPC_ALTITUDE]}));if(o>0){var u=r[o-1],l=u.x,c=u.y,h=u.z;JSON.stringify([l,c,h])===JSON.stringify(s[0])&&s.shift()}r.push.apply(r,Ye(s.map((function(t){return(new e.Vector3).fromArray(t)}))));var d=this.customCoords.lngLatsToCoords(s).map((function(e,t){return[e[0],e[1],s[t][2]||a]}));return i.push.apply(i,Ye(d.map((function(t){return(new e.Vector3).fromArray(t)})))),s}},{key:"setPath",value:function(e){}},{key:"reStart",value:function(){null==this._rayController&&this.initController()}},{key:"stop",value:function(){this._rayController&&this.destroyController()}},{key:"resume",value:function(){this._isMoving=!0}},{key:"pause",value:function(){this._isMoving=!1}},{key:"locateNPC",value:function(){}},{key:"setSpeed",value:function(e){this._conf.speed=e}},{key:"setCameraFollow",value:function(e){this._conf.cameraFollow=!!e}},{key:"initNPC",value:function(){var e=this._PATH_COORDS,t=this.scene,n=this._conf.NPC;n.up.set(0,0,1),e.length>1&&(n.position.copy(e[0]),n.lookAt(e[1])),t.add(n)}},{key:"updateNPC",value:function(){var e=this._conf,t=e.perspective,n=e.NPC,r=this.map,i=this.scene,a=this._PATH_COORDS,o=this.npc_step;if(1===t)n&&i.remove(n),r.setZoom(22);else if(3===t){if(n){i.add(n);var s=a[o];n.position.copy(s)}r.setZoom(20)}}},{key:"initController",value:function(){var t=this,n={t:0},r=this.getMoveDuration(),i=this._PATH_COORDS,a=this._PATH_LNG_LAT;this.map,this._rayController=new jn(n).to({t:1},r).easing(Fn.Linear.None).onUpdate((function(){var r=t._conf,o=r.NPC,s=r.cameraFollow,u=t.getNextStepIndex(),l=(new e.Vector3).copy(i[t.npc_step]),c=(new e.Vector3).copy(i[u]),h=(new e.Vector3).copy(l).lerp(c,n.t);if(o&&o.position.copy(h),s){var d=(new e.Vector3).copy(a[t.npc_step]),f=(new e.Vector3).copy(a[u]),p=(new e.Vector3).copy(d).lerp(f,n.t);t.updateMapCenter(p)}if(s){var v=t.getAngle(h,i[(t.npc_step+3)%i.length]);t.updateMapRotation(v)}})).onStart((function(){var e=t._conf.NPC,n=i[(t.npc_step+3)%i.length];e&&(e.lookAt(n),e.up.set(0,0,1))})).onComplete((function(){t.npc_step=t.getNextStepIndex();var e=t.getMoveDuration();n.t=0,t._rayController.stop().to({t:1},e).start()})).start()}},{key:"getNextStepIndex",value:function(){return(this.npc_step+1)%this._PATH_COORDS.length}},{key:"destroyController",value:function(){this._rayController.stop(),qn(this._rayController),this._rayController=null}},{key:"getMoveDuration",value:function(){var e=this._PATH_COORDS,t=this.npc_step,n=this._conf.speed,r=e[t],i=e[(t+1)%e.length],a=r.distanceTo(i)/n;return 1e3*Math.max(.2,a)}},{key:"updateMapCenter",value:function(e){this.map.panTo([e.x,e.y],0)}},{key:"updateMapRotation",value:function(e){Math.abs(e)>=1&&this.map.setRotation(e,!0,0)}},{key:"coordsToLngLat",value:function(e){var t=this.map,n=this.camera,r=this.container.getBoundingClientRect(),i=r.width,a=r.height,o=r.left,s=r.top;e.project(n),e.z=0;var u=(e.x+1)/2*i+o,l=(1-e.y)/2*a+s;return t.containerToLngLat([u,l])}},{key:"getAngle",value:function(e,t){var n=t.x-e.x,r=t.y-e.y,i=180*Math.atan2(r,n)/Math.PI;return-1*((i=90-(i=i>=0?i:360+i))>=-180?i:i+360)}},{key:"update",value:function(e){var t=this._rayController,n=this._isMoving;t&&n&&t.update(e)}}])}(),nr=function(){function t(n){var r;Oe(this,t);var i=He({data:null,altitude:0,interact:!0,pickEvent:"click",moveStep:1},n);return Ue(r=Ie(this,t,[i]),"_line",null),Ue(r,"_nodeData",[]),Ue(r,"_currNode",null),Ue(r,"_nodeGroup",[]),Ue(r,"_currNodeHelper",new e.AxesHelper(10)),Ue(r,"_nodeMt",new e.MeshBasicMaterial({color:65280})),Ue(r,"_currNodeMt",new e.MeshBasicMaterial({color:16711680})),r.initData(i.data),r}return ze(t,nt),Ne(t,[{key:"initData",value:function(t){var n,r=this,i=(null===(n=t.features[0])||void 0===n||null===(n=n.geometry)||void 0===n?void 0:n.coordinates[0])||[],a=this.customCoords.lngLatsToCoords(i);this._nodeData=a.map((function(t,n){var a=void 0===i[n][2]?r._conf.altitude:i[n][2];return new e.Vector3(t[0],t[1],a)})),this._data=a}},{key:"onReady",value:function(){this.initLine(),this.initNodes(),this.initInteract()}},{key:"initInteract",value:function(){var e=this;document.addEventListener("keydown",(function(t){if(e._currNode){var n=e._conf.moveStep,r=e._currNode.position,i=t.shiftKey?-1:1;switch(t.code){case"KeyX":e._currNode.position.set(r.x+n*i,r.y,r.z);break;case"KeyY":e._currNode.position.set(r.x,r.y+n*i,r.z);break;case"KeyZ":e._currNode.position.set(r.x,r.y,r.z+n*i)}e.reDraw()}}))}},{key:"reDraw",value:function(){this._nodeData=this._nodeGroup.map((function(t){return new e.Vector3(t.position.x,t.position.y,t.position.z)})),this.updateLine(this._nodeData)}},{key:"updateLine",value:function(e){var t=this._line.geometry;t.setFromPoints(e),t.attributes.position.needsUpdate=!0}},{key:"initLine",value:function(){var t=this.scene,n=new e.LineBasicMaterial({color:new e.Color("#00ff00")}),r=(new e.BufferGeometry).setFromPoints(this._nodeData),i=new e.Line(r,n);this._line=i,t.add(i)}},{key:"initNodes",value:function(){var t=this,n=new e.BoxGeometry(2,2,2),r=new e.Mesh(n,this._nodeMt);this._nodeData.forEach((function(e,n){var i=e.x,a=e.y,o=e.z,s=r.clone();s.position.set(i,a,o),s._attrs={index:n},t.scene.add(s),t._nodeGroup.push(s)}))}},{key:"onPicked",value:function(e){var t=e.targets;if(e.event,t.length>0){var n=t[0].object,r=n.geometry,i=n._attrs;"BoxGeometry"===(null==r?void 0:r.type)&&(console.log(JSON.stringify(i)),this.setCurrNode(t[0].object))}}},{key:"setCurrNode",value:function(e){var t=e._attrs;this._currNode&&this._currNode._attrs===t||(this._currNode&&(this._currNode.material=this._nodeMt,this._currNode.remove(this._currNodeHelper)),this._currNode=e,this._currNode.material=this._currNodeMt,this._currNode.add(this._currNodeHelper))}},{key:"getNodesLngLat",value:function(){var e=this;return this._nodeData.map((function(t){var n=e.coordsToLngLat(t.clone());return[n.lng,n.lat,t.z]}))}},{key:"coordsToLngLat",value:function(e){var t=this.map,n=this.camera,r=this.container.getBoundingClientRect(),i=r.width,a=r.height,o=r.left,s=r.top;e.z=0,e.project(n);var u=(e.x+1)/2*i+o,l=(1-e.y)/2*a+s;return t.containerToLngLat([u,l])}},{key:"update",value:function(){}}])}(),rr=function(){function t(n){var r;Oe(this,t);var i=He({type:"cube",size:[500,500,500],altitude:0},n.bound),a=He({size:1,ratio:.01,opacity:.5,textureURL:"./static/texture/rain_drop.png",count:1e4,speed:1},n.particleStyle),o=He({windAngle:0,windPower:0},n.wind);return delete n.bound,delete n.particleStyle,delete n.wind,Ue(r=Ie(this,t,[He(He({},n),{},{bound:i,particleStyle:a,wind:o})]),"_time",0),Ue(r,"_clock",new e.Clock),r}return ze(t,nt),Ne(t,[{key:"initData",value:function(e){}},{key:"onReady",value:function(){this.createScope()}},{key:"createScope",value:function(){var t=this.createMaterial(),n=this.createGeometry(),r=new e.Mesh(n,t);r.position.set(0,0,this._conf.bound.altitude),this.scene.add(r)}},{key:"createGeometry",value:function(){var t=this._conf.particleStyle,n=t.count,r=t.scale,i=t.ratio,a=this._conf.bound.size,o=new e.Box3(new e.Vector3(-a[0],-a[1],0),new e.Vector3(a[0],a[1],a[2])),s=this._conf.wind,u=s.windPower;s.windAngle;for(var l=new e.Vector3(1,1,0).normalize(),c=u*Math.PI/4,h=new e.BufferGeometry,d=[],f=[],p=[],v=[],m=0;m<n;m++){var g=new e.Vector3;g.x=Math.random()*(o.max.x-o.min.x)+o.min.x,g.y=Math.random()*(o.max.y-o.min.y)+o.min.y,g.z=Math.random()*(o.max.z-o.min.z)+o.min.z;for(var y=(o.max.z-o.min.z)*r/15,_=y*i,x=[g.x+_,g.y,g.z+y/2,g.x-_,g.y,g.z+y/2,g.x-_,g.y,g.z-y/2,g.x+_,g.y,g.z-y/2],w=(new e.Matrix4).makeRotationAxis(l,c),b=0;b<x.length;b+=3){var A=new e.Vector3(x[b],x[b+1],x[b+2]);A.sub(new e.Vector3(g.x,g.y,g.z)),A.applyMatrix4(w),A.add(new e.Vector3(g.x,g.y,g.z)),x[b]=A.x,x[b+1]=A.y,x[b+2]=A.z}d.push.apply(d,x),f.push(g.x,g.y,g.z,g.x,g.y,g.z,g.x,g.y,g.z,g.x,g.y,g.z),p.push(1,1,0,1,0,0,1,0),v.push(4*m+0,4*m+1,4*m+2,4*m+0,4*m+2,4*m+3)}return h.setAttribute("position",new e.BufferAttribute(new Float32Array(d),3)),h.setAttribute("normal",new e.BufferAttribute(new Float32Array(f),3)),h.setAttribute("uv",new e.BufferAttribute(new Float32Array(p),2)),h.setIndex(new e.BufferAttribute(new Uint32Array(v),1)),h}},{key:"createMaterial",value:function(){var t=this._conf.particleStyle,n=t.opacity,r=t.textureURL,i=this._conf.wind,a=i.windAngle,o=i.windPower,s=new e.MeshBasicMaterial({transparent:!0,opacity:n,alphaMap:(new e.TextureLoader).load(this.mergeSourceURL(r)),map:(new e.TextureLoader).load(this.mergeSourceURL(r)),depthWrite:!1,side:e.DoubleSide}),u=this._conf.bound.size[2],l=Math.ceil(Math.tan(o*Math.PI/4)*u),c=a*Math.PI/180;return s.onBeforeCompile=function(t,n){t.vertexShader=t.vertexShader.replace("#include <common>","\n            uniform float top; // 天花板高度\n            uniform float bottom; // 地面高度\n            uniform float time; // 时间轴进度\n            uniform float disX; // x轴移动距离\n            uniform float disY; // y轴移动距离\n            #include <common>\n            float angle(float x, float y){\n              return atan(y, x);\n            }\n            // 让所有面始终朝向相机\n            vec2 getFoot(vec2 camera,vec2 normal,vec2 pos){           \n                vec2 position;\n                //  计算法向量到点的距离\n                float distanceLen = distance(pos, normal);\n                // 计算相机位置与法向量之间的夹角\n                float a = angle(camera.x - normal.x, camera.y - normal.y);\n                // 根据点的位置和法向量的位置调整90度 \n                pos.x > normal.x ? a -= 0.785 : a += 0.785; \n                // 计算投影值\n                position.x = cos(a) * distanceLen;\n                position.y = sin(a) * distanceLen;\n                \n                return position + normal;\n            }\n            "),t.vertexShader=t.vertexShader.replace("#include <begin_vertex>","\n            vec2 foot = getFoot(vec2(cameraPosition.x, cameraPosition.y),  vec2(normal.x, normal.y), vec2(position.x, position.y));\n            float height = top - bottom;\n            // 计算目标当前高度\n            float z = normal.z - bottom - height * time;\n            // 落地后重新开始，保持运动循环\n            z = z + (z < 0.0 ? height : 0.0);\n            // 利用自由落体公式计算目标高度\n            float ratio = (1.0 - z / height) * (1.0 - z / height);\n            z = height * (1.0 - ratio);\n            float y = foot.y + disY * ratio;\n            float x = foot.x + disX * ratio;\n            // 调整坐标参考值\n            z += bottom;\n            z += position.z - normal.z;\n            // 生成变换矩阵\n            vec3 transformed = vec3( x, y, z );\n            "),t.uniforms.cameraPosition={value:new e.Vector3(0,0,0)},t.uniforms.top={value:u},t.uniforms.bottom={value:0},t.uniforms.time={value:0},t.uniforms.disX={value:l*Math.sin(c)},t.uniforms.disY={value:l*Math.cos(c)},s.uniforms=t.uniforms},this._material=s,s}},{key:"update",value:function(){var e=this._conf,t=this._time,n=this._clock,r=this._material,i=this.camera;e&&(this._time=n.getElapsedTime()*e.particleStyle.speed/2%1,r.uniforms&&(r.uniforms.cameraPosition.value=i.position,r.uniforms.time.value=t))}}])}(),ir=function(){function t(e){var n;Oe(this,t);var r=He({data:null},e);return(n=Ie(this,t,[r])).initData(r.data),n}return ze(t,nt),Ne(t,[{key:"initData",value:function(e){var t=this;this._data=JSON.parse(JSON.stringify(e)),this._data.forEach((function(e){e._center=t.customCoords.lngLatToCoord(e.center)})),console.log(this._data)}},{key:"onReady",value:function(){this.createPlanes()}},{key:"createPlanes",value:function(){var e=this;this._data.forEach((function(t){e.createOnePlane(t)}))}},{key:"createOnePlane",value:(n=Ee(We().mark((function t(n){var r,i,a,o,s,u,l,c,h;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.url,i=n.size,a=n._center,o=n.altitude,s=n.rotation,t.t0=e.VideoTexture,t.next=4,this.loadVideo(r);case 4:t.t1=t.sent,(u=new t.t0(t.t1)).colorSpace=e.SRGBColorSpace,l=new e.MeshLambertMaterial({map:u,side:e.DoubleSide,transparent:!0}),c=new e.PlaneGeometry(i[0],i[1]),(h=new e.Mesh(c,l)).position.set(a[0],a[1],o),h.rotation.z=e.MathUtils.degToRad(s),this.scene.add(h);case 13:case"end":return t.stop()}}),t,this)}))),function(e){return n.apply(this,arguments)})},{key:"loadVideo",value:function(e){return new Promise((function(t,n){var r=document.createElement("video");r.src=e,r.crossOrigin="anonymous",r.loop=!0,r.muted=!0,r.addEventListener("canplay",(function(){r.play(),t(r)}),!1),r.addEventListener("error",(function(e){n(e)}),!1),r.load()}))}},{key:"update",value:function(){}}]);var n}(),ar=function(){function t(n){var r;Oe(this,t);var i=Se.merge({zooms:[4,22],interact:!0,intensity:1,animate:!0,scale:1,colorStyle:{map:{0:"#be393a",1:"#f97f17",2:"#ffe056",3:"#2f81f7"},fieldName:null},label:{fieldName:"label",altitude:30},models:[],maxMainAltitude:1,minMainAltitude:0,mainAltitudeSpeed:1,rotateSpeed:1,traySpeed:1,PDI:!1},n);return Ue(r=Ie(this,t,[i]),"_lastPickIndex",{index:null,modelId:"main"}),Ue(r,"_data",[]),Ue(r,"_group",null),Ue(r,"_models",[]),Ue(r,"_mtMap",{}),Ue(r,"_offset",0),Ue(r,"_frameX",1),Ue(r,"_currentPosition",0),Ue(r,"_moveDirection",1),Ue(r,"_currentAngle",0),Ue(r,"_maxAngle",2*Math.PI),Ue(r,"_dummy",new e.Object3D),Ue(r,"_colorMap",{}),Ue(r,"_highLightIndexArray",[]),Ue(r,"_sizeMap",{}),Ue(r,"_altitudeMap",{}),Ue(r,"_maxMainAltitude",0),Ue(r,"_minMainAltitude",0),Ue(r,"_mainAltitudeSpeed",0),Ue(r,"_instancedMeshMap",{}),Ue(r,"_resolution",0),Ue(r,"_customRendererList",[]),Ue(r,"_customRendererIds",[]),r._models=Se.merge([{modelId:"main",name:"主体",size:1,altitude:1,sourceUrl:"./static/gltf/taper1.glb"},{modelId:"tray",name:"托盘",size:2,altitude:0,sourceUrl:"./static/gltf/taper1-p.glb"}],i.models),r.loader=null,i.data&&(r.data=i.data),r.init(),r}return ze(t,nt),Ne(t,[{key:"data",get:function(){return this._data},set:function(e){var t=this,n=e.features,r=[];if(n)this._data=n.map((function(e){var t=e.properties,n=e.geometry;return He(He({},t),{},{lngLat:n.coordinates})})),r=this.customCoords.lngLatsToCoords(n.map((function(e){return e.geometry.coordinates})));else{if(!Array.isArray(e))return console.error("poi3dlayer: this._data invalid"),!1;this._data=e,r=this.customCoords.lngLatsToCoords(e.map((function(e){return e.lngLat})))}this._customRendererList=[],this._customRendererIds=[],this._data.forEach((function(e,n){e.coords=r[n],e.renderer&&(t._customRendererList.push({index:n,data:e}),t._customRendererIds.push(n))})),this._data.length>0?(this.resetHeightLightIndexArray(),this.updateModel()):this.clear()}},{key:"init",value:function(){this.initColorMap(),this.refreshTransformData(),this.bindMethods(["handleContainerClick","handelViewChange","handelZoomChange"])}},{key:"beforeDestroy",value:function(){this.container&&this.container.removeEventListener("click",this.handleContainerClick),this.map&&(this.map.off("zoomchange",this.handelViewChange),this.map.off("zoomend",this.handelZoomChange))}},{key:"onRender",value:function(){}},{key:"onReady",value:(s=Ee(We().mark((function e(){return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateModel();case 2:this.initMouseEvent(),this.initLight(),this.handleEvent("ready",this);case 5:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"initColorMap",value:function(){var t=this,n=this._conf.colorStyle.map;this._colorMap={},Object.keys(n).forEach((function(r){t._colorMap[r]=new e.Color(n[r])}))}},{key:"handelViewChange",value:function(){this._conf.PDI&&(this.refreshTransformData(),this.updatePOIMesh())}},{key:"refreshTransformData",value:function(){var e=this,t=this._conf;this._resolution=this.getResolution()*this._conf.scale,this._models.forEach((function(t){var n=t.size,r=t.altitude,i=t.modelId;e._sizeMap[i]=3*e._resolution*(void 0!==n?n:e._conf.scale),e._altitudeMap[i]=e._resolution*r/.08})),this._maxMainAltitude=this._altitudeMap.main+t.maxMainAltitude*this._resolution/.08,this._minMainAltitude=this._altitudeMap.main+t.minMainAltitude*this._resolution/.08,this._mainAltitudeSpeed=t.mainAltitudeSpeed*this._resolution}},{key:"handelZoomChange",value:function(){this._conf.PDI,this._visible&&this.isInZooms()}},{key:"getColorByColorField",value:function(t,n){var r=this._conf.colorStyle.fieldName,i=null==r?n%Object.keys(this._colorMap).length:t[r];return this._colorMap[i]||new e.Color("#ffffff")}},{key:"initLight",value:function(){var t=this._conf.intensity,n=new e.AmbientLight(16777215,1*t);this.scene.add(n);var r=new e.DirectionalLight(16777215,1.5*t);r.position.set(1,1,1),this.scene.add(r)}},{key:"onPicked",value:function(e){var t,n,r=e.targets,i=e.event,a=null;if(r.length>0){var o=r[0].object;if(null!=o&&o.isInstancedMesh){var s=this._raycaster.intersectObject(o,!1)[0].instanceId;this.setLastPick(s),a=this._data[s],this.container.style.cursor="pointer"}}else null!==this._lastPickIndex.index&&(this.container.style.cursor="default"),this.removeLastPick();this.handleEvent("pick",{screenX:null==i||null===(t=i.pixel)||void 0===t?void 0:t.x,screenY:null==i||null===(n=i.pixel)||void 0===n?void 0:n.y,attrs:a})}},{key:"setLastPick",value:function(e){this._lastPickIndex.index=e}},{key:"removeLastPick",value:function(){var e=this._lastPickIndex.index;if(null!==e){var t=this.getMeshByModelId("main"),n=Ke(this._data[e].coords,2),r=n[0],i=n[1];this.updateMatrixAt(t,{size:this._sizeMap.main,position:[r,i,this._altitudeMap.main],rotation:[0,0,0]},e)}this._lastPickIndex.index=null}},{key:"loadOneModel",value:function(e,t){var n=this,r=this._models,i=e.modelId,a=e.sourceUrl;return new Promise((function(e){void 0!==(r.find((function(e){return e.modelId===i}))||{}).model?e():n.loader.load(n.mergeSourceURL(a),(function(n){var i=n.scene.children[0];r[t].model=i,e()}),(function(e){}),(function(e){console.log("loader model fail"+e)}))}))}},{key:"loadModel",value:(o=Ee(We().mark((function t(){var n;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null===this.loader&&(this.loader=new xt),null===this._group&&(this._group=new e.Group,this.scene.add(this._group)),n=0;case 3:if(!(n<this._models.length)){t.next=9;break}return t.next=6,this.loadOneModel(this._models[n],n);case 6:n++,t.next=3;break;case 9:this.handleEvent("loadModelCompleted",{modelsMap:this._models});case 10:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"clearModel",value:function(){if(this._group){var e=this._group.children;do{this._group.remove(e[0])}while(e.length>0)}}},{key:"getModelConfById",value:function(e){return this._models.find((function(t){return t.modelId===e}))}},{key:"initMouseEvent",value:function(){this.container.addEventListener("click",this.handleContainerClick),this.map.on("zoomchange",this.handelViewChange),this.map.on("zoomend",this.handelZoomChange)}},{key:"handleContainerClick",value:function(e){var t=this._lastPickIndex,n=this._data;null!=t.index&&this.handleEvent("click",{screenX:null==e?void 0:e.clientX,screenY:null==e?void 0:e.clientY,attrs:n[t.index]})}},{key:"updateModel",value:(a=Ee(We().mark((function e(){var t,n,r;return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.scene){e.next=2;break}return e.abrupt("return");case 2:if(!(this._data.length<=0)){e.next=5;break}return this.clear(),e.abrupt("return");case 5:return e.next=7,this.loadModel();case 7:return this.createMainMaterial(),e.next=10,this.createTrayMaterial();case 10:return e.next=12,this.createInstancedMeshes();case 12:this.clearModel(),t=this._models,n=0;case 15:if(!(n<t.length)){e.next=24;break}return e.next=18,this.updateInstancedMesh(t[n],this._data);case 18:r=e.sent,this._instancedMeshMap[t[n].modelId]=r,this._group.add(r);case 21:n++,e.next=15;break;case 24:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"updateMarker",value:function(){var e=this,t=this.map,n=this._conf.label.fieldName;this._data.forEach((function(r){if(r[n]<=0||["",void 0,null].includes(r[n]))e._labelMarkers.push(null);else{var i=Ke(r.lngLat,2),a=i[0],o=i[1],s=new AMap.Marker({offset:[-30,-15],position:[a,o,75*e._resolution],content:'<div class="gl-label-marker" style="width: 60px; color:#fff;text-align: center;font-weight: bold;">'.concat(r[n],"</div>"),map:t});e._labelMarkers.push(s)}}))}},{key:"clearLabelMarkers",value:function(){this.map&&this.map.remove(this._labelMarkers.filter((function(e){return null!==e}))),this._labelMarkers=[]}},{key:"setLabelMarkers",value:function(e){var t=e.altitude,n=void 0===t?0:t;this._labelMarkers.filter((function(e){return null!==e})).forEach((function(e){var t=e.getPosition(),r=t.lng,i=t.lat;e.setPosition([r,i,n])}))}},{key:"createTrayMaterial",value:(i=Ee(We().mark((function t(){var n,r,i,a,o,s;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new e.TextureLoader,t.next=3,n.loadAsync(this.mergeSourceURL("./static/texture/texture_wave_circle4.png"));case 3:r=t.sent,i=r.image,a=i.width,o=i.height,this._frameX=a/o,r.wrapS=r.wrapT=e.RepeatWrapping,r.repeat.set(1/this._frameX,1),s=new e.MeshStandardMaterial({color:"#ffffff",map:r,transparent:!0,opacity:.8,metalness:0,roughness:.6,depthTest:!0,depthWrite:!1}),this._mtMap.tray=s;case 10:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"createMainMaterial",value:function(){var t=this.getModelConfById("main").model.material.map,n=new e.MeshStandardMaterial({color:"#ffffff",side:e.FrontSide,transparent:!0,opacity:1,map:t});this._mtMap.main=n}},{key:"createInstancedMeshes",value:(r=Ee(We().mark((function t(){var n,r,i,a,o,s,u,l,c;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=this._models,r=this._data,i=this._mtMap,a=0;a<n.length;a++)o=n[a],s=o.model,u=o.modelId,l=i[u],(c=new e.InstancedMesh(s.geometry,l,r.length)).attrs={modelId:u},n[a].instancedMesh=c;case 2:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"updateInstancedMesh",value:(n=Ee(We().mark((function e(t,n){var r,i,a,o,s,u,l;return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=t.instancedMesh,i=t.modelId,a=n.length,o=this._sizeMap[i],this._dummy.scale.set(o,o,o),s=0;s<a;s++)(u=n[s]).id,l=u.coords,this._dummy.position.set(l[0],l[1],this._altitudeMap[i]),this._dummy.updateMatrix(),r.setMatrixAt(s,this._dummy.matrix),r.setColorAt(s,this.getColorByColorField(n[s],s));return e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getModelById",value:function(e){return this._group.children.find((function(t){return t._attrs.id===e}))||null}},{key:"getMeshByModelId",value:function(e){return(null==this?void 0:this._instancedMeshMap[e])||null}},{key:"clear",value:function(){this._highLightIndexArray=[],this._lastPickIndex.index=null,this.clearModel(),this.renderer&&this.renderer.clear()}},{key:"update",value:function(e){var t,n=this,r=this._conf,i=this._maxAngle,a=this._highLightIndexArray,o=this._lastPickIndex,s=this._sizeMap;if(this._isAnimate){null!=this&&null!==(t=this._mtMap)&&void 0!==t&&null!==(t=t.tray)&&void 0!==t&&t.map&&(this._offset+=.6*r.traySpeed,this._mtMap.tray.map.offset.x=Math.floor(this._offset)/this._frameX);var u=this.getMeshByModelId("main");if(u){this._currentPosition+=this._moveDirection*this._mainAltitudeSpeed,this._currentPosition>=this._maxMainAltitude?(this._currentPosition=this._maxMainAltitude,this._moveDirection*=-1):this._currentPosition<=this._minMainAltitude&&(this._currentPosition=this._minMainAltitude,this._moveDirection*=-1),this._customRendererList.forEach((function(e){var t=e.data.renderer(Object.assign(r,{size:s.main,altitude:n._altitudeMap}));n.updateMatrixAt(u,t,e.index)})),this._currentAngle=(this._currentAngle+.05*r.rotateSpeed)%i;for(var l=0;l<a.length;l++){var c=a[l];if(!this._customRendererIds.includes(c)){var h=Ke(this._data[c].coords,2),d=h[0],f=h[1];this.updateMatrixAt(u,{size:s.main,position:[d,f,this._currentPosition],rotation:[0,0,this._currentAngle]},c)}}if(null!==o.index&&!this._customRendererIds.includes(o.index)){var p=Ke(this._data[o.index].coords,2),v=p[0],m=p[1];this.updateMatrixAt(u,{size:1.2*s.main,position:[v,m,this._currentPosition],rotation:[0,0,this._currentAngle]},o.index)}null!=u&&u.instanceMatrix&&(u.instanceMatrix.needsUpdate=!0)}}}},{key:"updatePOIMesh",value:function(){var e,t=this._sizeMap,n=this.getMeshByModelId("main"),r=this.getMeshByModelId("tray");null!=this&&null!==(e=this._mtMap)&&void 0!==e&&null!==(e=e.tray)&&void 0!==e&&e.map&&(this._mtMap.tray.map.offset.x=0),this._currentPosition=0;for(var i=0;i<this._data.length;i++){var a=Ke(this._data[i].coords,2),o=a[0],s=a[1];this.updateMatrixAt(n,{size:t.main,position:[o,s,this._altitudeMap.main+this.getRandomValue()],rotation:[0,0,0]},i),this.updateMatrixAt(r,{size:t.tray,position:[o,s,this._altitudeMap.tray+this.getRandomValue()],rotation:[0,0,0]},i)}null!=n&&n.instanceMatrix&&(n.instanceMatrix.needsUpdate=!0),null!=r&&r.instanceMatrix&&(r.instanceMatrix.needsUpdate=!0)}},{key:"getRandomValue",value:function(){return 2*Math.random()-1}},{key:"resetHeightLightIndexArray",value:function(){var e=this._highLightIndexArray;if(e.length>0)for(var t=this.getMeshByModelId("main"),n=this.getModelConfById("main").altitude,r=0;r<e.length;r++){var i=Ke(this._data[r].coords,2),a=i[0],o=i[1];this.updateMatrixAt(t,{size:this._sizeMap.main,position:[a,o,n],rotation:[0,0,0]},r)}this._highLightIndexArray=[]}},{key:"updateMatrixAt",value:function(e,t,n){if(e){var r=t.size,i=t.position,a=t.rotation,o=this._dummy;o.scale.set(r,r,r),o.position.set(i[0],i[1],i[2]),o.rotation.x=a[0],o.rotation.y=a[1],o.rotation.z=a[2],o.updateMatrix(),e.setMatrixAt(n,o.matrix)}}},{key:"lightUp",value:function(e){var t=this,n=e.map((function(e){return t._data.findIndex((function(t){return t.id===e}))}));this._highLightIndexArray=Se.union(this._highLightIndexArray,Se.without(n,-1))}},{key:"lightOff",value:function(e){var t=this,n=e.map((function(e){return t._data.findIndex((function(t){return t.id===e}))}));this._highLightIndexArray=Se.difference(this._highLightIndexArray,n)}},{key:"switchLight",value:function(e){var t=this._data.findIndex((function(t){return t.id===e}));this._highLightIndexArray.includes(t)?this.lightOff([e]):this.lightUp([e])}},{key:"lightUpAll",value:function(){}},{key:"lightOffAll",value:function(){}}]);var n,r,i,a,o,s}();const or={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"};class sr{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const ur=new W(-1,1,1,-1,0,1),lr=new t;lr.setAttribute("position",new de([-1,3,0,-1,-1,0,3,-1,0],3)),lr.setAttribute("uv",new de([0,2,0,0,2,0],2));class cr{constructor(e){this._mesh=new U(lr,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,ur)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class hr extends sr{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof fe?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=pe.clone(e.uniforms),this.material=new fe({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new cr(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class dr extends sr{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),i=e.state;let a,o;i.buffers.color.setMask(!1),i.buffers.depth.setMask(!1),i.buffers.color.setLocked(!0),i.buffers.depth.setLocked(!0),this.inverse?(a=0,o=1):(a=1,o=0),i.buffers.stencil.setTest(!0),i.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),i.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),i.buffers.stencil.setClear(o),i.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),i.buffers.color.setLocked(!1),i.buffers.depth.setLocked(!1),i.buffers.color.setMask(!0),i.buffers.depth.setMask(!0),i.buffers.stencil.setLocked(!1),i.buffers.stencil.setFunc(r.EQUAL,1,4294967295),i.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),i.buffers.stencil.setLocked(!0)}}class fr extends sr{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class pr{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===t){const n=e.getSize(new g);this._width=n.width,this._height=n.height,(t=new ve(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:me})).texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new hr(or),this.copyPass.material.blending=ge,this.clock=new ye}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let t=0,r=this.passes.length;t<r;t++){const r=this.passes[t];if(!1!==r.enabled){if(r.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),r.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),r.needsSwap){if(n){const t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==dr&&(r instanceof dr?n=!0:r instanceof fr&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new g);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class vr extends sr{constructor(e,t,n=null,r=null,i=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=i,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new l}render(e,t,n){const r=e.autoClear;let i,a;e.autoClear=!1,null!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor)),null!==this.clearAlpha&&(i=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),1==this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),!0===this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),null!==this.clearColor&&e.setClearColor(this._oldClearColor),null!==this.clearAlpha&&e.setClearAlpha(i),null!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=r}}const mr={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new l(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};class gr extends sr{constructor(e,t,n,r){super(),this.strength=void 0!==t?t:1,this.radius=n,this.threshold=r,this.resolution=void 0!==e?new g(e.x,e.y):new g(256,256),this.clearColor=new l(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let i=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new ve(i,a,{type:me}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){const t=new ve(i,a,{type:me});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);const n=new ve(i,a,{type:me});n.texture.name="UnrealBloomPass.v"+e,n.texture.generateMipmaps=!1,this.renderTargetsVertical.push(n),i=Math.round(i/2),a=Math.round(a/2)}const o=mr;this.highPassUniforms=pe.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new fe({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];const s=[3,5,7,9,11];i=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(s[e])),this.separableBlurMaterials[e].uniforms.invSize.value=new g(1/i,1/a),i=Math.round(i/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1;this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new _(1,1,1),new _(1,1,1),new _(1,1,1),new _(1,1,1),new _(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const u=or;this.copyUniforms=pe.clone(u.uniforms),this.blendMaterial=new fe({uniforms:this.copyUniforms,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:_e,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new l,this.oldClearAlpha=1,this.basic=new p,this.fsQuad=new cr(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(n,r),this.renderTargetsVertical[e].setSize(n,r),this.separableBlurMaterials[e].uniforms.invSize.value=new g(1/n,1/r),n=Math.round(n/2),r=Math.round(r/2)}render(e,t,n,r,i){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let o=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[t].uniforms.direction.value=gr.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=gr.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[t];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new fe({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new g(.5,.5)},direction:{value:new g(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 invSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float gaussianCoefficients[KERNEL_RADIUS];\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat weightSum = gaussianCoefficients[0];\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianCoefficients[i];\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}getCompositeMaterial(e){return new fe({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}gr.BlurDirectionX=new g(1,0),gr.BlurDirectionY=new g(0,1);var yr=function(){function t(e,n,r,i){return Oe(this,t),Ie(this,t,[e,n,r,i])}return ze(t,gr),Ne(t,[{key:"getSeperableBlurMaterial",value:function(t){for(var n=[],r=0;r<t;r++)n.push(.39894*Math.exp(-.5*r*r/(t*t))/t);return new e.ShaderMaterial({defines:{KERNEL_RADIUS:t},uniforms:{colorTexture:{value:null},invSize:{value:new e.Vector2(.5,.5)},direction:{value:new e.Vector2(.5,.5)},gaussianCoefficients:{value:n}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 invSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float gaussianCoefficients[KERNEL_RADIUS];\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat weightSum = gaussianCoefficients[0];\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n\t\t\t\t\tfloat alphaSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianCoefficients[i];\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset );\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset );\n\t\t\t\t\t\tdiffuseSum += (sample1.rgb + sample2.rgb) * w;\n\t\t\t\t\t\talphaSum += (sample1.a + sample2.a) * w; //\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\t//gyrate: overwrite this line for alpha pass\n\t\t\t\t\t//gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, alphaSum/weightSum);\n\t\t\t\t}"})}}])}();const _r={uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:"\n\t\tprecision highp float;\n\n\t\tuniform mat4 modelViewMatrix;\n\t\tuniform mat4 projectionMatrix;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\t\n\t\tprecision highp float;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\t"+xe.tonemapping_pars_fragment+xe.colorspace_pars_fragment+"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t// tone mapping\n\n\t\t\t#ifdef LINEAR_TONE_MAPPING\n\n\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = OptimizedCineonToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\n\t\t\t#endif\n\n\t\t\t// color space\n\n\t\t\t#ifdef SRGB_TRANSFER\n\n\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\n\t\t\t#endif\n\n\t\t}"};class xr extends sr{constructor(){super();const e=_r;this.uniforms=pe.clone(e.uniforms),this.material=new we({uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.fsQuad=new cr(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,this._outputColorSpace===e.outputColorSpace&&this._toneMapping===e.toneMapping||(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},Z.getTransfer(this._outputColorSpace)===be&&(this.material.defines.SRGB_TRANSFER=""),this._toneMapping===Ae?this.material.defines.LINEAR_TONE_MAPPING="":this._toneMapping===Me?this.material.defines.REINHARD_TONE_MAPPING="":this._toneMapping===Te?this.material.defines.CINEON_TONE_MAPPING="":this._toneMapping===ke&&(this.material.defines.ACES_FILMIC_TONE_MAPPING=""),this.material.needsUpdate=!0),!0===this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}const wr={uniforms:{tDiffuse:{value:null},resolution:{value:new g(1/1024,1/512)}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\tprecision highp float;\n\n\tuniform sampler2D tDiffuse;\n\n\tuniform vec2 resolution;\n\n\tvarying vec2 vUv;\n\n\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t//----------------------------------------------------------------------------------\n\t// File:        es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t// SDK Version: v3.00\n\t// Email:       gameworks@nvidia.com\n\t// Site:        http://developer.nvidia.com/\n\t//\n\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t//\n\t// Redistribution and use in source and binary forms, with or without\n\t// modification, are permitted provided that the following conditions\n\t// are met:\n\t//  * Redistributions of source code must retain the above copyright\n\t//    notice, this list of conditions and the following disclaimer.\n\t//  * Redistributions in binary form must reproduce the above copyright\n\t//    notice, this list of conditions and the following disclaimer in the\n\t//    documentation and/or other materials provided with the distribution.\n\t//  * Neither the name of NVIDIA CORPORATION nor the names of its\n\t//    contributors may be used to endorse or promote products derived\n\t//    from this software without specific prior written permission.\n\t//\n\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t//\n\t//----------------------------------------------------------------------------------\n\n\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t//     For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t#endif\n\n\t/*--------------------------------------------------------------------------*/\n\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t/*--------------------------------------------------------------------------*/\n\n\t#define NUM_SAMPLES 5\n\n\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t}\n\n\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t============================================================================*/\n\n\t/*--------------------------------------------------------------------------*/\n\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t\t// locate the edge\n\t\t\t\t\tvec2 dirToEdge;\n\t\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t\t// . 2 .      . 1 .\n\t\t\t\t\t// 1 0 2  ~=  0 0 1\n\t\t\t\t\t// . 1 .      . 0 .\n\n\t\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t\t// . 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 H\n\n\t\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t\t// V 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 .\n\n\t\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t\t\t// 1 1 .\n\t\t\t\t\t\t\t// 0 0 1\n\t\t\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t\t\t// do a simple blur\n\t\t\t\t\t\t\treturn mix(\n\t\t\t\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t\t\t\t.4\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 .      1\n\t\t\t// 1 0 1  ->  0\n\t\t\t// . 0 .      1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\t\titerationsUsed = i;\n\n\t\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\t\tif(!doneN) {\n\t\t\t\t\t\t\tnDist += increment;\n\t\t\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!doneP) {\n\t\t\t\t\t\t\tpDist += increment;\n\t\t\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\t\trgbaM,\n\t\t\t\t\trgbaN,\n\t\t\t\t\tdist * .5\n\t\t\t);\n\t}\n\n\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\t\tvUv,\n\t\t\t\t\ttDiffuse,\n\t\t\t\t\tresolution,\n\t\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t}\n\t"};var br=function(){function t(e){var n;Oe(this,t),Ue(n=Ie(this,t,[e]),"id",null),Ue(n,"map",null),Ue(n,"_conf",{layer:null,zIndex:120}),Ue(n,"_customLayer",null),Ue(n,"_visible",!0),Ue(n,"_canvas",null),Ue(n,"_composer",null),Ue(n,"_bloomPass",null),Ue(n,"_renderer",null),Ue(n,"_composerList",[]),Ue(n,"_style",{threshold:0,strength:1,radius:1.5,fxxa:!0});var r=Se.merge(n._conf,e);return n._style=Se.merge(n._style,r.style),n.id=e.id||(new Date).getTime().toString(),n.map=e.map,n.map?(n.bindMethods(["animate","resizeLayer","setLayerVisible"]),n.init(),n):(console.error("缺少地图对象"),je(n))}return ze(t,Je),Ne(t,[{key:"bindMethods",value:function(e){var t=this;e.forEach((function(e){t[e]=t[e].bind(t)}))}},{key:"visible",get:function(){return this._visible},set:function(e){this._visible=e,this._customLayer[e?"show":"hide"]()}},{key:"init",value:(n=Ee(We().mark((function e(){return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.createLayer();case 2:this.initComposer(),this.animate(),this.addModuleListener(),this.handleEvent("init",this);case 6:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"add",value:function(e){var t=this.createComposer(e),n=this.createPassShader(t,{mode:0,visible:e.getVisible()});this._composerList.push(t);var r=this._composerList.length;this._composer.insertPass(n,r),e.on("visibleChange",this.setLayerVisible)}},{key:"remove",value:function(e){var t=this._composerList.findIndex((function(t){return t.passes[0].scene===e.scene}));t>-1&&(this._composerList.splice(t,1),this._composer.passes.splice(t+1,1)),0===this._composerList.length&&this._composer.renderer.clear(),e.off("visibleChange",this.setLayerVisible)}},{key:"setLayerVisible",value:function(e,t){var n=this._composerList.findIndex((function(e){return e.passes[0].scene===t.scene}));n>-1&&(this._composer.passes[n+1].enabled=e)}},{key:"clear",value:function(){this._composer&&(this._composer.passes.length=0),this._composerList.forEach((function(e){e.dispose()})),this._composerList=[],this._composer.renderer.clear()}},{key:"createComposer",value:function(e){var t=e.scene,n=e.camera,r=new pr(this._renderer);r.renderToScreen=!1;var i=new vr(t,n);return i.clear=!0,i.clearDepth=!1,r.addPass(i),r}},{key:"createPassShader",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{mode:0,visible:!0},r=n.mode,i=new hr(new e.ShaderMaterial({uniforms:{baseTexture:{value:null},coverTexture:{value:null},mode:{value:r}},vertexShader:"\n          varying vec2 vUv;\n          void main() {\n              vUv = uv;\n              gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n          }\n      ",fragmentShader:"\n          uniform sampler2D baseTexture;\n          uniform sampler2D coverTexture;\n          uniform int mode;\n          varying vec2 vUv;\n          void main() {\n\n            vec4 baseColor = texture2D(baseTexture, vUv);\n            vec4 bloomColor = texture2D(coverTexture, vUv);\n\n            if(mode == 0){\n              gl_FragColor = ( baseColor + vec4( 1.0 ) * bloomColor );\n            }else if(mode == 1){\n              gl_FragColor = bloomColor * (1.0 - baseColor.a) + baseColor;\n            }else if(mode ==2){\n              gl_FragColor = baseColor * (1.0 - bloomColor.a) + bloomColor;\n            }\n          }\n      ",defines:{}}),"baseTexture");return i.uniforms.coverTexture.value=t.renderTarget2.texture,i.renderToScreen=!0,i.needsSwap=!0,i.enabled=n.visible,i}},{key:"createRenderer",value:function(){var t=this.getScale(),n=t.width,r=t.height,i=new e.WebGLRenderer({context:this._canvas.getContext("webgl"),alpha:!0,depth:!0});return i.autoClear=!0,i.setClearAlpha(0),i.setSize(n,r),i}},{key:"animate",value:function(e){if(void 0!==this){var t=this._composerList,n=this._composer;t&&t.length&&(t.forEach((function(e){e.render()})),n.render()),requestAnimationFrame(this.animate)}}},{key:"initComposer",value:function(){var t=this.createRenderer(),n=new pr(t),r=new vr(new e.Scene,new e.Camera);r.clear=!0,n.addPass(r);var i=this.createBloomPass(this._conf.style);n.addPass(i),this._style.fxxa&&n.addPass(this.createFXAAPass()),n.addPass(this.createOutputPass()),this._bloomPass=i,this._composer=n,this._renderer=t}},{key:"createFXAAPass",value:function(){var e=this.getScale(),t=e.width,n=e.height,r=new hr(wr);return r.uniforms.resolution.value.set(1/t,1/n),r}},{key:"createBloomPass",value:function(t){var n=t.threshold,r=t.strength,i=t.radius,a=this.getScale(),o=a.width,s=a.height;return new yr(new e.Vector2(o,s),r,i,n)}},{key:"createOutputPass",value:function(){var e=new xr;return e.clear=!1,e}},{key:"createLayer",value:function(){var e=this;return new Promise((function(t,n){var r=e.getScale(),i=r.width,a=r.height,o=document.createElement("canvas");o.width=i,o.height=a,o.style.cssText="width: ".concat(i,"px; height: ").concat(a,"px;"),o.setAttribute("belong","effect"),e._canvas=o,e._customLayer=new AMap.CustomLayer(o,{zooms:[2,22],alwaysRender:!0}),e.map.add(e._customLayer),t()}))}},{key:"updatePass",value:function(){this._bloomPass&&(this._bloomPass.threshold=this._style.threshold,this._bloomPass.strength=this._style.strength,this._bloomPass.radius=this._style.radius)}},{key:"setStyle",value:function(e){this._style=Se.merge(this._style,e),this.updatePass()}},{key:"toggle",value:function(){var e=this._visible;this[e?"hide":"show"](),this._visible=!e}},{key:"show",value:function(){this._canvas&&(this._canvas.style.display="block")}},{key:"hide",value:function(){this._canvas&&(this._canvas.style.display="none")}},{key:"destroy",value:function(){for(var e in this.removeModuleListener(),this.clear(),this._customLayer&&(this.map.remove(this._customLayer),this._customLayer.destroy()),this)delete this[e]}},{key:"addModuleListener",value:function(){window.addEventListener("resize",this.resizeLayer)}},{key:"removeModuleListener",value:function(){window.removeEventListener("resize",this.resizeLayer)}},{key:"resizeLayer",value:function(){var e=this.getScale(),t=e.width,n=e.height;this._canvas&&(this._canvas.width=t,this._canvas.height=n,this._canvas.style.width=t+"px",this._canvas.style.height=n+"px"),this._composer&&this._composer.setSize(t,n),this._renderer&&this._renderer.setSize(t,n)}},{key:"getScale",value:function(){var e=this.map.getContainer();return{width:e.clientWidth,height:e.clientHeight}}}]);var n}(),Ar=function(e,t){var n,r,i,a,o,s,u,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*l:e.length,d=Mr(e,0,h,l,!0),f=[];if(!d||d.next===d.prev)return f;if(c&&(d=function(e,t,n,r){var i,a,o,s=[];for(i=0,a=t.length;i<a;i++)(o=Mr(e,t[i]*r,i<a-1?t[i+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(Dr(o));for(s.sort(Pr),i=0;i<s.length;i++)n=Er(s[i],n);return n}(e,t,d,l)),e.length>80*l){n=i=e[0],r=a=e[1];for(var p=l;p<h;p+=l)(o=e[p])<n&&(n=o),(s=e[p+1])<r&&(r=s),o>i&&(i=o),s>a&&(a=s);u=0!==(u=Math.max(i-n,a-r))?32767/u:0}return kr(d,f,l,n,r,u,0),f};function Mr(e,t,n,r,i){var a,o;if(i===function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Wr(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Wr(a,e[a],e[a+1],o);return o&&Br(o,o.next)&&(Xr(o),o=o.next),o}function Tr(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!Br(r,r.next)&&0!==Fr(r.prev,r,r.next))r=r.next;else{if(Xr(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function kr(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;do{0===i.z&&(i.z=Or(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,u,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ);t++);for(u=l;s>0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(e,r,i,a);for(var s,u,l=e;e.prev!==e.next;)if(s=e.prev,u=e.next,a?Cr(e,r,i,a):Sr(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),Xr(e),e=u.next,l=u.next;else if((e=u)===l){o?1===o?kr(e=Rr(Tr(e),t,n),t,n,r,i,a,2):2===o&&Lr(e,t,n,r,i,a):kr(Tr(e),t,n,r,i,a,1);break}}}function Sr(e){var t=e.prev,n=e,r=e.next;if(Fr(t,n,r)>=0)return!1;for(var i=t.x,a=n.x,o=r.x,s=t.y,u=n.y,l=r.y,c=i<a?i<o?i:o:a<o?a:o,h=s<u?s<l?s:l:u<l?u:l,d=i>a?i>o?i:o:a>o?a:o,f=s>u?s>l?s:l:u>l?u:l,p=r.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=h&&p.y<=f&&Nr(i,s,a,u,o,l,p.x,p.y)&&Fr(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Cr(e,t,n,r){var i=e.prev,a=e,o=e.next;if(Fr(i,a,o)>=0)return!1;for(var s=i.x,u=a.x,l=o.x,c=i.y,h=a.y,d=o.y,f=s<u?s<l?s:l:u<l?u:l,p=c<h?c<d?c:d:h<d?h:d,v=s>u?s>l?s:l:u>l?u:l,m=c>h?c>d?c:d:h>d?h:d,g=Or(f,p,t,n,r),y=Or(v,m,t,n,r),_=e.prevZ,x=e.nextZ;_&&_.z>=g&&x&&x.z<=y;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==i&&_!==o&&Nr(s,c,u,h,l,d,_.x,_.y)&&Fr(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==i&&x!==o&&Nr(s,c,u,h,l,d,x.x,x.y)&&Fr(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;_&&_.z>=g;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==i&&_!==o&&Nr(s,c,u,h,l,d,_.x,_.y)&&Fr(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==i&&x!==o&&Nr(s,c,u,h,l,d,x.x,x.y)&&Fr(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Rr(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Br(i,a)&&zr(i,r,r.next,a)&&Hr(i,a)&&Hr(a,i)&&(t.push(i.i/n|0),t.push(r.i/n|0),t.push(a.i/n|0),Xr(r),Xr(r.next),r=e=a),r=r.next}while(r!==e);return Tr(r)}function Lr(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Ur(o,s)){var u=jr(o,s);return o=Tr(o,o.next),u=Tr(u,u.next),kr(o,t,n,r,i,a,0),void kr(u,t,n,r,i,a,0)}s=s.next}o=o.next}while(o!==e)}function Pr(e,t){return e.x-t.x}function Er(e,t){var n=function(e,t){var n,r=t,i=-1/0,a=e.x,o=e.y;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=a&&s>i&&(i=s,n=r.x<r.next.x?r:r.next,s===a))return n}r=r.next}while(r!==t);if(!n)return null;var u,l=n,c=n.x,h=n.y,d=1/0;r=n;do{a>=r.x&&r.x>=c&&a!==r.x&&Nr(o<h?a:i,o,c,h,o<h?i:a,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(a-r.x),Hr(r,e)&&(u<d||u===d&&(r.x>n.x||r.x===n.x&&Ir(n,r)))&&(n=r,d=u)),r=r.next}while(r!==l);return n}(e,t);if(!n)return t;var r=jr(n,e);return Tr(r,r.next),Tr(n,n.next)}function Ir(e,t){return Fr(e.prev,e,t.prev)<0&&Fr(t.next,e,e.next)<0}function Or(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Dr(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Nr(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function Ur(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&zr(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Hr(e,t)&&Hr(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Fr(e.prev,e,t.prev)||Fr(e,t.prev,t))||Br(e,t)&&Fr(e.prev,e,e.next)>0&&Fr(t.prev,t,t.next)>0)}function Fr(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Br(e,t){return e.x===t.x&&e.y===t.y}function zr(e,t,n,r){var i=Vr(Fr(e,t,n)),a=Vr(Fr(e,t,r)),o=Vr(Fr(n,r,e)),s=Vr(Fr(n,r,t));return i!==a&&o!==s||(!(0!==i||!Gr(e,n,t))||(!(0!==a||!Gr(e,r,t))||(!(0!==o||!Gr(n,e,r))||!(0!==s||!Gr(n,t,r)))))}function Gr(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Vr(e){return e>0?1:e<0?-1:0}function Hr(e,t){return Fr(e.prev,e,e.next)<0?Fr(e,t,e.next)>=0&&Fr(e,e.prev,t)>=0:Fr(e,t,e.prev)<0||Fr(e,e.next,t)<0}function jr(e,t){var n=new Kr(e.i,e.x,e.y),r=new Kr(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Wr(e,t,n,r){var i=new Kr(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Xr(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Kr(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Yr=function(){function t(e){var n;Oe(this,t);var r=He({data:null,altitude:0,opacity:1,interact:!1,lineWidth:50,lineColor:"#FFFFFF",sizeAttenuation:1},e);return Ue(n=Ie(this,t,[r]),"_data",[]),Ue(n,"_lastPick",{mesh:null,opacity:null}),n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"initData",value:function(e){var t=this;e.features.forEach((function(e){var n=e.geometry,r=e.properties;switch(n.type){case"MultiPolygon":n.coordinates[0].forEach((function(e){t._data.push({path:t.customCoords.lngLatsToCoords(e),properties:r})}));break;case"Polygon":t._data.push({path:t.customCoords.lngLatsToCoords(n.coordinates[0]),properties:r})}})),console.log(this._data)}},{key:"onReady",value:function(){this.createMesh()}},{key:"getParentObject",value:function(e){var t=e.object;do{var n;if(["Scene","Group"].includes(null===(n=t.parent)||void 0===n?void 0:n.type))return t;t=t.parent}while(t)}},{key:"onPicked",value:function(e){var t,n,r=e.targets,i=e.event,a=null;if(r.length>0){var o=this.getParentObject(r[0]);o?(this.setLastPick(o),a=o._attrs):this.removeLastPick()}else this.removeLastPick();this.handleEvent("pick",{screenX:null==i||null===(t=i.pixel)||void 0===t?void 0:t.x,screenY:null==i||null===(n=i.pixel)||void 0===n?void 0:n.y,attrs:a})}},{key:"setLastPick",value:function(e){e&&(this.removeLastPick(),this._lastPick={mesh:e,opacity:e.material.opacity},e.material.opacity=.9)}},{key:"removeLastPick",value:function(){if(this._lastPick.mesh){var e=this._lastPick,t=e.mesh,n=e.opacity;t.material.opacity=n,this._lastPick={mesh:null,opacity:null}}}},{key:"createMesh",value:function(){var e=this;this._data.forEach((function(t){e.drawPolygon(t),e._conf.lineWidth>0&&e.drawLines(t)}))}},{key:"drawPolygon",value:function(t){for(var n=t.path,r=t.properties,i=this._conf,a=i.altitude,o=i.opacity,s=n.map((function(e){return[e[0],e[1],a]})).flat(),u=Ar(s,null,3),l=new e.BufferGeometry,c=[],h=0;h<u.length;h++){var d=Ke(n[u[h]],3),f=d[0],p=d[1];d[2],c=[].concat(Ye(c),[f,p,a])}l.setAttribute("position",new e.BufferAttribute(new Float32Array(c),3)),l.computeVertexNormals();var v=new e.MeshBasicMaterial({color:r.color||"#0674F1",transparent:!0,opacity:r.opacity||o}),m=new e.Mesh(l,v);(this.group||this.scene).add(m)}},{key:"drawLines",value:function(t){var n=this,r=t.path;t.properties;var i=[];r.forEach((function(t){var r=Ke(t,3),a=r[0],o=r[1];r[2],i.push(new e.Vector3(a,o,n._conf.altitude+10))}));var a=new gt;a.setPoints(i);var o=new e.Mesh(a,this.getLineMaterial());(this.group||this.scene).add(o)}},{key:"getLineMaterial",value:function(){if(null==this._lineMaterial){var t=this._conf,n=t.sizeAttenuation,r=t.lineWidth,i=t.lineColor;this._lineMaterial=new yt({useMap:0,color:new e.Color(i),opacity:1,depthTest:!0,sizeAttenuation:n?1:0,lineWidth:r})}return this._lineMaterial}},{key:"getRandomColor",value:function(){for(var e="#",t=0;t<6;t++)e+="0123456789ABCDEF"[Math.floor(16*Math.random())];return e}},{key:"update",value:function(){}}])}();class Qr{constructor(e=.1,t=6){this.maxEdgeLength=e,this.maxIterations=t}modify(e){null!==e.index&&(e=e.toNonIndexed());const n=this.maxIterations,r=this.maxEdgeLength*this.maxEdgeLength,i=new _,a=new _,o=new _,s=new _,u=[i,a,o,s],c=new _,h=new _,d=new _,f=new _,p=[c,h,d,f],v=new l,m=new l,y=new l,x=new l,w=[v,m,y,x],b=new g,A=new g,M=new g,T=new g,k=[b,A,M,T],S=new g,C=new g,R=new g,L=new g,P=[S,C,R,L],E=e.attributes,I=void 0!==E.normal,O=void 0!==E.color,D=void 0!==E.uv,N=void 0!==E.uv1;let U=E.position.array,F=I?E.normal.array:null,B=O?E.color.array:null,z=D?E.uv.array:null,G=N?E.uv1.array:null,V=U,H=F,j=B,W=z,X=G,K=0,Y=!0;function Q(e,t,n){const r=u[e],i=u[t],a=u[n];if(V.push(r.x,r.y,r.z),V.push(i.x,i.y,i.z),V.push(a.x,a.y,a.z),I){const r=p[e],i=p[t],a=p[n];H.push(r.x,r.y,r.z),H.push(i.x,i.y,i.z),H.push(a.x,a.y,a.z)}if(O){const r=w[e],i=w[t],a=w[n];j.push(r.x,r.y,r.z),j.push(i.x,i.y,i.z),j.push(a.x,a.y,a.z)}if(D){const r=k[e],i=k[t],a=k[n];W.push(r.x,r.y),W.push(i.x,i.y),W.push(a.x,a.y)}if(N){const r=P[e],i=P[t],a=P[n];X.push(r.x,r.y),X.push(i.x,i.y),X.push(a.x,a.y)}}for(;Y&&K<n;){K++,Y=!1,U=V,V=[],I&&(F=H,H=[]),O&&(B=j,j=[]),D&&(z=W,W=[]),N&&(G=X,X=[]);for(let e=0,t=0,n=U.length;e<n;e+=9,t+=6){i.fromArray(U,e+0),a.fromArray(U,e+3),o.fromArray(U,e+6),I&&(c.fromArray(F,e+0),h.fromArray(F,e+3),d.fromArray(F,e+6)),O&&(v.fromArray(B,e+0),m.fromArray(B,e+3),y.fromArray(B,e+6)),D&&(b.fromArray(z,t+0),A.fromArray(z,t+2),M.fromArray(z,t+4)),N&&(S.fromArray(G,t+0),C.fromArray(G,t+2),R.fromArray(G,t+4));const n=i.distanceToSquared(a),u=a.distanceToSquared(o),l=i.distanceToSquared(o);n>r||u>r||l>r?(Y=!0,n>=u&&n>=l?(s.lerpVectors(i,a,.5),I&&f.lerpVectors(c,h,.5),O&&x.lerpColors(v,m,.5),D&&T.lerpVectors(b,A,.5),N&&L.lerpVectors(S,C,.5),Q(0,3,2),Q(3,1,2)):u>=n&&u>=l?(s.lerpVectors(a,o,.5),I&&f.lerpVectors(h,d,.5),O&&x.lerpColors(m,y,.5),D&&T.lerpVectors(A,M,.5),N&&L.lerpVectors(C,R,.5),Q(0,1,3),Q(3,2,0)):(s.lerpVectors(i,o,.5),I&&f.lerpVectors(c,d,.5),O&&x.lerpColors(v,y,.5),D&&T.lerpVectors(b,M,.5),N&&L.lerpVectors(S,R,.5),Q(0,1,3),Q(3,1,2))):Q(0,1,2)}}const Z=new t;return Z.setAttribute("position",new de(V,3)),I&&Z.setAttribute("normal",new de(H,3)),O&&Z.setAttribute("color",new de(j,3)),D&&Z.setAttribute("uv",new de(W,2)),N&&Z.setAttribute("uv1",new de(X,2)),Z}}var Zr=function(){function t(e){var n;Oe(this,t);var r=He({data:null,altitude:0,opacity:1,interact:!1,intensity:.9,lineWidth:100,lineColor:"#FFFFFF",sizeAttenuation:1,textureMapURL:null,normalMapURL:null,displacementMapURL:null,segment:15,sideTextureMapURL:"./static/texture/texture_cake_1.png"},e);return Ue(n=Ie(this,t,[r]),"_data",[]),Ue(n,"_lastPick",{mesh:null,opacity:null}),Ue(n,"_extRange",{minX:0,minY:0,maxX:0,maxY:0}),Ue(n,"_topMesh",null),Ue(n,"_topMeshProps",{}),Ue(n,"_sideMesh",null),Ue(n,"_sideMeshProps",{}),Ue(n,"_CANVAS_MAX_LEN",2e3),n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"initData",value:function(e){var t=this;e.features.forEach((function(e){var n=e.geometry,r=e.properties;switch(n.type){case"MultiPolygon":n.coordinates[0].forEach((function(e){t._data.push({path:t.customCoords.lngLatsToCoords(e),properties:r})}));break;case"Polygon":t._data.push({path:t.customCoords.lngLatsToCoords(n.coordinates[0]),properties:r})}})),console.log(this._data)}},{key:"onReady",value:(r=Ee(We().mark((function e(){return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.initExtRange(),e.next=3,this.initTexture();case 3:this.createTopMesh(),this._conf.altitude>0&&this.createSideMesh({height:this._conf.altitude}),this._conf.lineWidth>0&&this.createEdge(),this.initLight();case 7:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"initLight",value:function(){var t=this._conf.intensity,n=new e.DirectionalLight(16777215,1*t);n.position.set(1,1,1),this.scene.add(n);var r=new e.AmbientLight(4210752,2*t);this.scene.add(r)}},{key:"getParentObject",value:function(e){var t=e.object;do{var n;if("Scene"===(null===(n=t.parent)||void 0===n?void 0:n.type))return t;t=t.parent}while(t)}},{key:"onPicked",value:function(e){var t,n,r=e.targets,i=e.event,a=null;if(r.length>0){var o=this.getParentObject(r[0]);o?(this.setLastPick(o),a=o._attrs):this.removeLastPick()}else this.removeLastPick();this.handleEvent("pick",{screenX:null==i||null===(t=i.pixel)||void 0===t?void 0:t.x,screenY:null==i||null===(n=i.pixel)||void 0===n?void 0:n.y,attrs:a})}},{key:"setLastPick",value:function(e){e&&(this.removeLastPick(),this._lastPick={mesh:e,opacity:e.material.opacity},e.material.opacity=.9)}},{key:"removeLastPick",value:function(){if(this._lastPick.mesh){var e=this._lastPick,t=e.mesh,n=e.opacity;t.material.opacity=n,this._lastPick={mesh:null,opacity:null}}}},{key:"createEdge",value:function(){var t=this,n=this._data[0].path,r=[];n.forEach((function(n){var i=Ke(n,3),a=i[0],o=i[1];i[2],r.push(new e.Vector3(a,o,t._conf.altitude+20))}));var i=new gt;i.setPoints(r);var a=this._conf,o=a.sizeAttenuation,s=a.lineWidth,u=a.lineColor,l=new yt({useMap:0,color:new e.Color(u),opacity:1,depthTest:!0,sizeAttenuation:o?1:0,lineWidth:s}),c=new e.Mesh(i,l);this.scene.add(c),this._edgeMesh=c}},{key:"getLineMaterial",value:function(){return null==this._lineMaterial&&(this._lineMaterial=new yt({useMap:0,color:new e.Color(lineColor),opacity:1,depthTest:!0,sizeAttenuation:sizeAttenuation?1:0,lineWidth:lineWidth})),this._lineMaterial}},{key:"createTopMesh",value:function(){var t=this._conf,n=t.normalScale,r=t.displacementScale,i=this._topMeshProps,a=i.textureMap,o=i.normalMap,s=i.displacementMap,u=i.alphaMap;a.encoding=e.sRGBEncoding;var l=new e.MeshStandardMaterial({side:e.DoubleSide,map:a,normalMap:o,normalScale:new e.Vector2(n,n),alphaMap:u,displacementMap:s,displacementScale:r,displacementBias:0,wireframe:!1,transparent:!0,alphaTest:.1}),c=this.generateTopGeometry(),h=new e.Mesh(c,l);h.position.set(0,0,this._conf.altitude),this.scene.add(h),this._topMesh=h}},{key:"generateTopGeometry",value:function(){var t=this._conf.segment,n=this._extRange,r=n.minX,i=n.minY,a=n.maxX,o=n.maxY,s=[[r,i],[r,o],[a,o],[a,i]],u=new e.Shape;s.forEach((function(e,t){var n=Ke(e,2),r=n[0],i=n[1];0===t?u.moveTo(r,i):u.lineTo(r,i)}));var l=new e.ShapeGeometry(u);l=new Qr(.1,t).modify(l);var c=this.getGeometryUV(l),h=new e.BufferAttribute(c,2);return l.setAttribute("uv",h),l}},{key:"generateAlphaMap",value:function(){var t=this._data[0].path.map((function(t){var n=Ke(t,2),r=n[0],i=n[1];return new e.Vector3(r,i,0)})),n=this._extRange,r=n.minX,i=n.minY,a=n.maxX,o=n.maxY,s=Math.max(a-r,o-i),u=this._CANVAS_MAX_LEN/s,l=t.map((function(t){var n=(t.x-r)*u,a=(t.y-i)*u;return new e.Vector3(n,a,t.z)})),c=Math.ceil((a-r)*u),h=Math.ceil((o-i)*u),d=this.generateCanvas({width:c,height:h}),f=d.getContext("2d");f.fillStyle="#000000",f.fillRect(0,0,c,h),f.fillStyle="#FFFFFF",f.beginPath(),f.moveTo(l[0].x,l[0].y);for(var p=1;p<l.length;p++)f.lineTo(l[p].x,l[p].y);return f.closePath(),f.fill(),new e.CanvasTexture(d,null,e.RepeatWrapping,e.RepeatWrapping)}},{key:"generateCanvas",value:function(e){var t=e.width,n=e.height,r=document.createElement("canvas");r.width=t,r.height=n;var i=r.getContext("2d");return i.translate(0,n),i.scale(1,-1),r}},{key:"setSegment",value:function(e){this._conf.segment=e,this._topMesh.geometry=this.generateTopGeometry()}},{key:"initTexture",value:(n=Ee(We().mark((function t(){var n,r,i,a,o,s;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=["textureMap","normalMap","displacementMap"],r=0;case 2:if(!(r<n.length)){t.next=14;break}return i=n[r],a=this._conf["".concat(i,"URL")],t.next=7,(new e.TextureLoader).load(a);case 7:(o=t.sent).wrapS=e.RepeatWrapping,o.wrapT=e.RepeatWrapping,this._topMeshProps[i]=o;case 11:r++,t.next=2;break;case 14:return this._topMeshProps.alphaMap=this.generateAlphaMap(),t.next=17,(new e.TextureLoader).load(this._conf.sideTextureMapURL);case 17:(s=t.sent).wrapS=e.RepeatWrapping,s.wrapT=e.RepeatWrapping,s.offset.set(0,1),this._sideMeshProps.textureMap=s;case 22:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"initExtRange",value:function(){for(var e=this._data[0].path,t=e[0][0],n=e[0][1],r=e[0][0],i=e[0][1],a=0;a<e.length;a+=3){var o=Ke(e[a],2),s=o[0],u=o[1];s<t?t=s:s>r&&(r=s),u<n?n=u:u>i&&(i=u)}this._extRange={minX:t,minY:n,maxX:r,maxY:i}}},{key:"getGeometryUV",value:function(e){for(var t=e.attributes.position.count,n=new Float32Array(2*t),r=this._extRange,i=r.minX,a=r.minY,o=r.maxX,s=r.maxY,u=0;u<t;u++){var l=2*u,c=(e.attributes.position.getX(u)-i)/(o-i),h=(e.attributes.position.getY(u)-a)/(s-a);n[l]=c,n[l+1]=h}return n}},{key:"createSideGeometry",value:function(t,n){var r=n.height;t[0].toString()!==t[t.length-1].toString()&&t.push(t[0]);for(var i=[],a=[],o=[],s=[0,0],u=[1,0],l=[1,1],c=[0,1],h=0;h<t.length;h++){var d=Ke(t[h],3),f=d[0],p=d[1],v=d[2];i.push([f,p,0]),i.push([f,p,void 0!==v?v:r])}for(var m=0;m<i.length-2;m++)m%2==0?(a=[].concat(Ye(a),Ye(i[m]),Ye(i[m+2]),Ye(i[m+1])),o=[].concat(Ye(o),s,u,c)):(a=[].concat(Ye(a),Ye(i[m]),Ye(i[m+1]),Ye(i[m+2])),o=[].concat(Ye(o),c,u,l));var g=new e.BufferGeometry;return g.setAttribute("position",new e.BufferAttribute(new Float32Array(a),3)),g.setAttribute("uv",new e.BufferAttribute(new Float32Array(o),2)),g}},{key:"createSideMesh",value:function(t){var n=t.height,r=void 0===n?0:n;if(t.name,!(r<=0)){var i=this._data[0].path,a=this.createSideGeometry(i,{height:r}),o=new e.MeshBasicMaterial({side:e.DoubleSide,transparent:!0,depthWrite:!0,map:this._sideMeshProps.textureMap}),s=new e.Mesh(a,o);this.scene.add(s),this._sideMesh=s}}},{key:"updateUniforms",value:function(e,t){this._topMesh.material.uniforms[e].value=t}},{key:"updateMaterial",value:function(e,t){this._topMesh.material[e]=t}},{key:"update",value:function(){}}]);var n,r}(),qr="\n      varying vec2 vUv;\n      varying vec3 v_position;\n      void main() {\n          vUv = uv;\n          gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n          v_position = vec3(modelMatrix * vec4(position, 1.0));\n      }\n  ",Jr="   \n     varying vec2 vUv;\n     varying vec3 v_position;\n\n     uniform float innerCircleWidth;\n     uniform float circleWidth;\n     uniform float radius;\n     uniform float opacity;\n     uniform vec3 center;\n     uniform vec3 color;\n     uniform sampler2D textureMap;\n     uniform vec2 repeat;\n\n     void main() {\n       float dis = length(v_position - center);\n\n       // 不超过半径范围，且与波动有交集\n       if( dis < radius && dis < (innerCircleWidth + circleWidth) && dis > innerCircleWidth) {\n          // 计算当前片元的位置占整个圆环宽度的比例\n          float r = (dis - innerCircleWidth) / circleWidth;\n\n          // 透明度衰减起始点和终止点\n          float startDecay = radius * 0.5;\n          float endDecay = radius;\n\n          // 计算透明度\n          float alpha = 1.0;\n          if (dis > startDecay) {\n              alpha = 1.0 - (dis - startDecay) / (endDecay - startDecay);\n          }\n          if (dis >= endDecay) {\n              alpha = 0.0;\n          }         \n          \n          // 方案1： 纹理和颜色混合\n          gl_FragColor = mix(texture2D(textureMap, vUv * repeat), vec4(color, opacity), r);\n          // 叠加 过程透明度 和 位置透明度  \n          gl_FragColor.a *= alpha * r;\n\n          // 方案2：只显示纹理\n          // gl_FragColor = vec4(color, 1.0) * texture2D(textureMap, vUv);\n       }else {\n          // 丢弃片元不渲染\n          discard;\n       }        \n\n     }\n  ",$r="\n      varying vec2 vUv;\n      void main() \n      {\n          vUv = uv;\n          gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n      }\n  ",ei="   \n      const float PI = 3.14159265359;\n      const float TWO_PI = 6.28318530718;\n      // 边长数量\n      const int N = 3;\n      // 中间圆心的尺寸\n      const float r0 = 0.01;\n      // 蓝色闪烁点的尺寸\n      const float r_blue = 0.005;\n      // 红色闪烁点的尺寸\n      const float r_red = 0.005;\n      // 雷达完整尺寸占画布的比例\n      const float edge = 0.95;\n      const float offset = 0.05;\n      \n      // 动画时间\n      uniform float time;\n      // 扫描扇形范围叠加的纹理\n      uniform sampler2D textureMap;\n      varying vec2 vUv;\n      \n      // 绘制辐射直径\n      // 参数：当前像素坐标，指定绘制位置， 线宽\n      float plot(const vec2 st, const float pct, const float width)\n      {\n          return smoothstep(pct - width, pct, st.y) -  smoothstep(pct, pct + width, st.y);\n      }\n      \n      // 绘制雷达追踪到的多边形物体\n      // 参数：物体中心 边数  半径 画布位置\n      float drawPolygon(const vec2 polygonCenter, const int N, const float radius, vec2 pos)\n      {\n        pos = pos - polygonCenter;\n        float d = 0.0;\n        float a = atan(pos.x, pos.y);\n        float r = TWO_PI / float(N);\n        d = cos(floor(0.5 + a / r)*r - a)*length(pos);\n        return (1.0 - smoothstep(radius, radius + radius/10.0, d));\n      }\n      \n      // 生成圆盘的刻度\n      // 参数：当前角度 a， 刻度数量 gradNum， 圆盘半径 outRad， 刻度长 tickLen，刻度宽 tickWidth， r, 旋转速度\n      float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n      {\n      float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n          return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n      }\n            \n      void main(  )\n      {\n          // 屏幕像素坐标（从0到1）\n          vec2 uv = vUv;\n          // 圆心位置\n          vec2 pos = uv.xy - vec2(0.5, 0.5) ; \n             \n          // 扫描区域叠加的叠加纹理图\n          vec4 mapcol = texture2D(textureMap,uv) * vec4 (0.0, 0.85, 0.0, 1.0);\n            \n          vec3 color = vec3(0.0, 0.0, 0.0);\n          \n          float r = length(pos) * 2.0;\n          // 当前像素点的角度\n          float a = atan(pos.y, pos.x); \n          // 雷达扫描的角度\n          float an = PI - mod(time/ 1.0, TWO_PI); \n          // 被追踪物体的移动速度\n          float blipSpd = 3.0; \n          vec2 translate1 = vec2(cos(time/ blipSpd), sin(time/ blipSpd));\n          vec2 translate2 = vec2(sin(time/ blipSpd), cos(time/ blipSpd));\n          vec2 left1 = translate1 * 0.35;\n          vec2 right1 = -translate1 * 0.30;\n          vec2 left2 = translate2 * 0.15;\n          vec2 right2 = -translate2 * 0.25;\n                    \n          //  雷达扫描\n          float sn = step(PI/2.0, an) * step(-PI/2.0, (a + an)) * step(r, edge) * (1.0 - 0.55 * (a + (TWO_PI) - an));\n          float sw = step(an, a) * step(r, edge);\n          float s_blade = sw * (1.0 - (a - an) * 20.0);\n          float s = sw * (1.0 - 0.55 * (a - an));\n          s = max(sn,s);\n          float se = step(r, edge - 0.05);\n             \n          // 外圈圆\n          float s1 = smoothstep(edge - 0.00, edge + 0.01, r)* smoothstep(edge + 0.02, edge + 0.01, r);   \n             \n          // 同心圆：中心点 内圈 中圈          \n          float s0 = 1.0 - smoothstep(r0 / 2.0, r0, length(pos));\n          float smb = (1.0 - smoothstep(0.2, 0.2 + 0.01, length(pos))) * (1.0 - smoothstep(0.2 +0.01, 0.2, length(pos)));\n          float smr = (1.0 - smoothstep(0.3, 0.3 + 0.01, length(pos))) * (1.0 - smoothstep(0.3 +0.01, 0.3, length(pos)));\n          \n          // Circular concentric gradations\n          float gradNum = 120.0;\n          float tickWidth = 0.9;\n          const float tickLen = 0.04;\n          float outRad = edge;\n          float move = 0.0;\n          // 绘制外圈刻度\n          float sm = 0.75*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);   \n                       \n          gradNum = 36.0;\n          tickWidth = 0.95;\n          outRad = 0.6;\n          move = sin(time/10.0);\n          // 绘制中圈刻度\n          smr += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);         \n         \n          outRad = 0.4;\n          move = cos(time/10.0);\n          // 绘制内圈刻度\n          smb += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n          \n          // 8条辐射线\n          float sr = plot(pos, pos.x, 0.003) * step(r, edge - 0.06);\n          sr += plot(vec2(0.0, 0.0), pos.x, 0.002) * step(r, edge - 0.06);\n          sr += plot(vec2(0.0, 0.0), pos.y, 0.003) * step(r, edge - 0.06);\n          sr += plot(-pos, pos.x, 0.003) * step(r, edge - 0.06);\n          sr *= 0.75;\n      \n          // 蓝色圆形被追踪物体\n          vec2 st_trace1 = left2;\n          float s_trace1 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1)));\n          s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+offset, +offset))));\n          s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+2.0 *offset, +2.0 *offset))));\n          \n          vec2 st_trace2 = right1;\n          float s_trace2 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace2)));\n          \n          // 红色三角形被追踪物体\n          vec2 st_trace3 = left1;\n          float st1 = s * (drawPolygon(st_trace3, N, r_red , pos));\n          st1 += s * (drawPolygon(st_trace3 + vec2(-offset, -offset), N, r_red, pos));\n          st1 += s * (drawPolygon(st_trace3 + vec2(+offset, -offset), N, r_red, pos));\n          \n          vec2 st_trace4 = right2;\n          float st2 = s * (drawPolygon(st_trace4, N, r_red, pos));  \n              \n          // 叠加扫描区域和纹理图\n          float s_grn = max(s * mapcol.y, s_blade);\n          // 叠加： 扫描区域， 中心点 辐射线 外圈刻度\n          s_grn = max(s_grn, (s0 +  sr + sm));\n          // 叠加：外 中 内圈  加强颜色：/0.5\n          s_grn += (s1  + smb  + smr) / 0.5 ; \n          \n          // 将被追踪物体置于顶部\n          float s_red = st1*2.0 + st2*2.0 + smr;          \n          float s_blue = max(s_trace1 + s_trace2, s_blade) + smb;\n          \n          if (s_trace1 > 0.0 || s_trace2 > 0.0) { \n            s_blue = max(s, s_blue); \n            s_grn = max(s_grn, s_blue); \n          }\n      \n          color += vec3(s_red , s_grn, s_blue);            \n          vec4 texColor = mapcol * s;\n          \n          // 过滤掉纯黑色背景\n          if (color == vec3(0.0, 0.0, 0.0)) {\n              discard;\n          }else{\n            gl_FragColor = vec4(color, s_red + s_grn + s_blue); \n          }\n      \n      }\n  ",ti=function(){function t(e){var n;Oe(this,t);var r=He({altitude:0,radius:1e3,duration:2e3,easingFunction:"Easing.Linear.None",textureMapURL:"./static/texture/ring_0.png",color:"#ffffff",opacity:1,mode:"rotate",rotateOptions:{direction:1,initAngle:0},spreadOptions:{initRadius:0,circleWidth:void 0,center:void 0}},e);return Ue(n=Ie(this,t,[r]),"_angle",0),Ue(n,"_spreadStep",0),Ue(n,"_mesh",null),Ue(n,"_tweenInstance",null),n.initData(r.data),n}return ze(t,nt),Ne(t,[{key:"initData",value:function(e){}},{key:"onReady",value:(s=Ee(We().mark((function e(){return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.initOptions(),this.initTween(),e.next=4,this.createMesh();case 4:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"initOptions",value:function(){var e=this._conf,t=e.mode,n=e.rotateOptions,r=e.spreadOptions,i=e.radius;switch(t){case"rotate":this._angle=n.initAngle;break;case"spread":this._spreadStep=Math.max(this._conf.radius/240,1);var a=r.circleWidth,o=r.center,s=r.initRadius,u=r.repeat;void 0===a&&(r.circleWidth=Math.max(1,parseInt(i/10))),void 0===s&&(r.initRadius=0),o instanceof Array==!1&&(r.center=[0,0]),u instanceof Array==!1&&(r.repeat=[1,1])}}},{key:"initTween",value:function(){var e=this,t={t:0},n=this._conf,r=n.duration,i=n.radius,a=n.mode,o=n.rotateOptions,s=n.spreadOptions,u=n.easingFunction;this._tweenInstance&&(this._tweenInstance.stop(),this._tweenInstance=null);var l=u.split(".").reduce((function(e,t){return e&&e[t]}),er);this._tweenInstance=new jn(t).to({t:1},r).easing(l).onUpdate((function(){switch(a){case"rotate":e._angle>360?e._angle=o.initAngle:e._angle=o.initAngle+t.t*(360-o.initAngle)*o.direction,e._mesh.material.map.rotation=e._angle*Math.PI/180;break;case"spread":var n=e._mesh.material.uniforms.innerCircleWidth;n.value=s.initRadius+t.t*(i-s.initRadius),n.value>i&&(n.value=s.initRadius);break;case"radar":e._mesh.material.uniforms.time.value+=12/r}})).onComplete((function(){t.t=0,e._tweenInstance.stop().to({t:1},r).start()})).start()}},{key:"createMesh",value:(o=Ee(We().mark((function t(){var n,r,i,a,o,s,u;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=this._conf,r=n.radius,i=n.altitude,a=n.mode,o=new e.PlaneGeometry(2*r,2*r),s=null,t.t0=a,t.next="rotate"===t.t0?6:"spread"===t.t0?10:"radar"===t.t0?14:18;break;case 6:return t.next=8,this.generateRotateMaterial();case 8:return s=t.sent,t.abrupt("break",19);case 10:return t.next=12,this.generateSpreadMaterial();case 12:return s=t.sent,t.abrupt("break",19);case 14:return t.next=16,this.generateRadarMaterial();case 16:return s=t.sent,t.abrupt("break",19);case 18:return t.abrupt("break",19);case 19:(u=new e.Mesh(o,s)).position.set(0,0,i),this.scene.add(u),this._mesh=u;case 23:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"generateRotateMaterial",value:(a=Ee(We().mark((function t(){var n,r,i,a,o,s;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._conf,r=n.textureMapURL,i=n.color,a=n.opacity,t.next=3,(new e.TextureLoader).load(r);case 3:return(o=t.sent).wrapS=e.ClampToEdgeWrapping,o.wrapT=e.ClampToEdgeWrapping,o.center=new e.Vector2(.5,.5),s=new e.MeshBasicMaterial({side:e.DoubleSide,map:o,transparent:!0,alphaTest:.01,opacity:a,color:i,depthWrite:!1}),t.abrupt("return",s);case 9:case"end":return t.stop()}}),t,this)}))),function(){return a.apply(this,arguments)})},{key:"generateRadarMaterial",value:(i=Ee(We().mark((function t(){var n,r,i,a,o;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._conf.textureMapURL,r=$r,i=ei,t.next=4,(new e.TextureLoader).load(n);case 4:return a=t.sent,o=new e.ShaderMaterial({uniforms:{textureMap:{value:a},time:{value:0}},vertexShader:r,fragmentShader:i,transparent:!0,depthWrite:!1}),t.abrupt("return",o);case 7:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"generateSpreadMaterial",value:(r=Ee(We().mark((function t(){var n,r,i,a,o,s,u,l,c,h,d,f,p;return We().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._conf,r=n.textureMapURL,i=n.radius,a=n.spreadOptions,o=n.color,s=a.initRadius,u=a.circleWidth,l=a.center,c=a.repeat,t.next=4,(new e.TextureLoader).load(r);case 4:return(h=t.sent).wrapS=e.RepeatWrapping,h.wrapT=e.RepeatWrapping,h.center=new e.Vector2(.5,.5),d=qr,f=Jr,p=new e.ShaderMaterial({uniforms:{innerCircleWidth:{value:s},circleWidth:{value:u},color:{value:new e.Color(o||16777215)},opacity:{value:.8},center:{value:new e.Vector3(l[0],l[1])},radius:{value:i},textureMap:{value:h},repeat:{value:new e.Vector2(c[0],c[1])}},vertexShader:d,fragmentShader:f,transparent:!0,depthWrite:!1}),t.abrupt("return",p);case 11:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"setRadius",value:function(t){this._conf.radius=t;var n=new e.PlaneGeometry(2*t,2*t);this._mesh.geometry=n}},{key:"setDuration",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;this._conf.duration=e,this.initTween()}},{key:"setEasing",value:function(e){this._conf.easingFunction=e,this.initTween()}},{key:"setAltitude",value:function(e){this._mesh.position.set(0,0,e)}},{key:"updateMaterial",value:function(e,t){this._mesh.material[e]=t,"map"===e&&(this._texture=t)}},{key:"update",value:function(e){var t;void 0!==(null==this||null===(t=this._mesh)||void 0===t?void 0:t.material)&&this._tweenInstance&&this._tweenInstance.update()}},{key:"setMode",value:(n=Ee(We().mark((function e(t){var n;return We().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._conf.mode=t,this.initOptions(),this.initTween(),n=null,e.t0=t,e.next="rotate"===e.t0?7:"spread"===e.t0?11:"radar"===e.t0?15:19;break;case 7:return e.next=9,this.generateRotateMaterial();case 9:return n=e.sent,e.abrupt("break",20);case 11:return e.next=13,this.generateSpreadMaterial();case 13:return n=e.sent,e.abrupt("break",20);case 15:return e.next=17,this.generateRadarMaterial();case 17:return n=e.sent,e.abrupt("break",20);case 19:return e.abrupt("break",20);case 20:this._mesh.material=n;case 21:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}]);var n,r,i,a,o,s}(),ni={Layer:nt,LayerManager:rt,BorderLayer:ot,BuildingLayer:dt,MonoBuildingLayer:ft,CakeLayer:_t,ModelLayer:mn,MassModelLayer:gn,FlowlineLayer:yn,IconLayer:_n,PointIconLayer:bn,PointsLayer:Tn,ScatterLayer:kn,SpriteLayer:Sn,TilesLayer:En,WaterLayer:On,TerrainLayer:Un,DrivingLayer:tr,PolylineEditor:nr,WeatherLayer:rr,VideoLayer:ir,POI3dLayer:ar,EffectLayer:br,PolygonLayer:Yr,TerrainPolygonLayer:Zr,HaloLayer:ti,MaskLayer:function(){function t(e){var n;Oe(this,t);var r=He({data:null,opacity:0,altitude:1},e);return Ue(n=Ie(this,t,[r]),"_paths",[]),void 0===r.data?(console.log("props data is required"),je(n)):(n.initData(r.data),n._data=r.data,n)}return ze(t,nt),Ne(t,[{key:"onReady",value:function(){this.createMesh()}},{key:"createMesh",value:function(){var t=this,n=this.getMaterial();this._paths.forEach((function(r){var i=t.generateGeometry(r),a=new e.Mesh(i,n);a.position.z=t._conf.altitude,t.scene.add(a)}))}},{key:"generateGeometry",value:function(t){var n=new e.Shape;return t.forEach((function(e,t){var r=Ke(e,2),i=r[0],a=r[1];0===t?n.moveTo(i,a):n.lineTo(i,a)})),new e.ShapeGeometry(n)}},{key:"initData",value:function(e){var t=this;e.features.forEach((function(e){e.geometry.coordinates.forEach((function(e){var n=e[0][0]instanceof Array?e[0]:e,r=t.customCoords.lngLatsToCoords(n);t._paths.push(r)}))}))}},{key:"getMaterial",value:function(){return new e.MeshBasicMaterial({color:16777215,opacity:0,side:e.DoubleSide,transparent:!0,alphaTest:0,depthWrite:!0})}},{key:"update",value:function(){}}])}(),PictureLayer:function(){function t(e){var n;return Oe(this,t),Ue(n=Ie(this,t,[He({data:null,extent:null,picUrl:null,opacity:1},e)]),"animTime",0),Ue(n,"_extent",[]),n.initData(),n}return ze(t,nt),Ne(t,[{key:"onReady",value:function(){this.createTexture()}},{key:"initData",value:function(){var e,t=this.customCoords.lngLatsToCoords(this._conf.extent);(e=this._extent).push.apply(e,Ye(t))}},{key:"createTexture",value:function(){var t=this,n=this.scene;(new e.TextureLoader).load(this._conf.picUrl,(function(r){r.encoding=e.sRGBEncoding,r.encoding=e.sRGBEncoding;var i=new e.PlaneGeometry(t._extent[1][0]-t._extent[0][0],t._extent[1][1]-t._extent[0][1]),a=new e.MeshBasicMaterial({transparent:!0,side:e.DoubleSide,depthWrite:!1,map:r,opacity:t._conf.opacity}),o=new e.Mesh(i,a);n.add(o),o.position.set((t._extent[0][0]+t._extent[1][0])/2,(t._extent[0][1]+t._extent[1][1])/2,0)}))}},{key:"update",value:function(){}}])}()};window.GLlayers=ni;export{ni as default};
